Python Forum
python in JES homework question,
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python in JES homework question,
#1
I am using JES to learn python. My teacher gave us a project but my code is not working. I believe the problem lies on line 35 but I don't know what I am doing wrong. I need someone to please explain it to me.

Thank you
Lisa S

[def main():
# show dialog box with "Welcome to Acme Corporation, your one-stop Widget superstore!"
  showInformation( "Welcome to Acme Corporation, your one-stop WIdget superstore!" )
# show dialog box with "Cost $10.00 per unit with volume discounts as follows:"
  showInformation( "Cost $10.00 per unit with volume discounts as follows:" )
# show dialog box with 4 lines of text showing "11-30 = 10% off, 31-70 = 15% off, 71-100 = 20% off, 101+ = 25% off
  showInformation( "11-30 = 10% off \n31-70 = 15% off \n71-100 = 20% off \n101+ = 25% off" )
# ask user for number of widgets they wish to by as an integer from 1 to 1000 inclusive using the words minimum quantity is 1 and the maximum is 1000
  number_of_widgets = requestInteger( "How many widgets would you like to buy? \nThe minimum quantity you can order is 1 and the maximum is 1000" )
# create if statement if number of widgets is < 1 or > 1000 a dialog box will say "The minimum order is 1 and the maximum is 1000. Goodbye." and ends the program
  if number_of_widgets < 1 or number_of_widgets > 1000:
    showInformation( "The minimum order is 1 and the maximum is 1000. \n Goodbye." )
# create and else statement if number of widgets is in the correct range
# create a nested if statement to compute the discount amount based on the number order using  variable for unit cost of $10.00 and a base cost for the order before discount is applied
  else:
    base_cost = float(number_of_widgets*10.00)
  printNow( number_of_widgets )
  printNow( base_cost )
# create a nested if statement based on the number ordered to store the varialbe discount to store the whole number of the corresponding discount
  if number_of_widgets >= 11 and number_of_widgets <= 30:
    discount = 10
  elif number_of_widgets >= 31 and number_of_widgets <= 70:
    discount = 15
  elif number_of_widgets >= 71 and number_of_widgets <= 100:
    discount = 20
  elif number_of_widgets >= 101 and number_of_widgets <= 1000:
    discount = 25
  printNow( discount )
# convert  discount to decimal number variable named discount_percentage
  discount_percentage = float(discount/100)
  printNow( discount_percentage )
# calculate the final cost as base cost - discount_percentage * base cost
  final_cost = float(base_cost-(discount_percentage*base_cost))
  printNow( final_cost )
# show dialog box displaying the number of widgets ordered, the discount percentage applied, and the final cost
  showInformation( "You have ordered " + str(number_of_widgets) + " number of Widgets. \nThis means you are eligable for " + str(discount) + "% off. \nSo your final cost is $" + str(final_cost))
# Ask user if they wish to submit the order using a string "Y for yes N for no"
  correct = requestString( "Would you like to submit the order? \n Plese give a Y for Yes and an N for no" )
# create if statement if string is equal to "Y" or "y" then display a dialog box saying "Thanks for your order else say "Maybe next time..."
  if correct == "Y" or correct == "y":
    showInformation( "Thanks for your order!" )
  else:
    showInformation( "Maybe next time..." )
Reply
#2
Did you get the answer to this figured out?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  HELP in python homework makashito 4 3,897 Oct-12-2021, 10:12 AM
Last Post: buran
  CyperSecurity Using Python HomeWork ward1995 1 1,948 Jul-08-2021, 03:55 PM
Last Post: buran
Exclamation urgent , Python homework alm 2 2,286 May-09-2021, 11:19 AM
Last Post: Yoriz
  Homework with python Johnsonmfw 1 1,676 Sep-20-2020, 04:03 AM
Last Post: ndc85430
  Homework help:While Loops question Midhat_School 6 3,071 Jul-26-2020, 10:23 AM
Last Post: pyzyx3qwerty
  IF ELSE Homework Question buckthimble 1 2,130 Mar-29-2020, 06:29 AM
Last Post: buran
  Python Homework Help *Urgent GS31 2 2,565 Nov-24-2019, 01:41 PM
Last Post: ichabod801
  Python Homework Question OrcDroid123 1 2,362 Sep-01-2019, 08:44 AM
Last Post: buran
  Python homework / functions sunhyunshine 1 2,436 May-11-2019, 05:37 PM
Last Post: MrTheOne
  Homework question dmhhfm 4 13,337 Apr-10-2019, 07:22 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020