Question

For PYTHON program you will be writing a program that will use if-else or if-elif-else statements....

For PYTHON program you will be writing a program that will use if-else or if-elif-else statements.

Read-It-All bookstore has a book sales club where customers can earn reward points that can be used for their next purchase.

If a customer purchases 0 books, he/she earns 0 points.

If a customer purchases 1-3 books, he/she earns 5 points.

If a customer purchases 4-6 books, he/she earns 10 points.

If a customer purchases 7-8 books, he/she earns 15 points.

If a customer purchases 9 books, he/she earns 20 points.

If a customer purchases 10 or more books, he/she earns 25 points.

Write a program that asks the user to enter their name (First and last name), and the number of books that he or she has purchased this month and displays their name and the number of points they have earned for the month. Your program may run once per user, or may loop to accept multiple users.

REMEMBER to put your name on the lab with comments, and write comments in the program to tell what the program is doing.

Data for the program:

Mary Smith              5 books

John Franklin            1 book

Stewart Jones           0 books

Marvin Applegate      7 books

Ernestine Miller         8 books

Francis Butterworth   3 books

Arlene Cooper          0 books

Maryanne Fisher       2 books

Andrea Martin          10 books

Larry Andrews          9 books

PLEASE DO IN THE SIMPLEST FORM. Also, explain what it is you are doing and why. Thanks.

Homework Answers

Answer #1

#If a customer purchases 0 books, he/she earns 0 points.

#If a customer purchases 1-3 books, he/she earns 5 points.

#If a customer purchases 4-6 books, he/she earns 10 points.

#If a customer purchases 7-8 books, he/she earns 15 points.

#If a customer purchases 9 books, he/she earns 20 points.
game_active = 1 #setting a condition for running the code n number of time.
while game_active > 0 :
#read the first and last name
   FirstName = input('Please Enter your first name: ')
   LastName = input('Please Enter your first name: ')
   #read the number of books
   num = int(input ('Please enter number of books purchased this month:'))
   #initialise the base points to 0
   points = 0
   #Check the given points conditions using if then else loop as below
   if num == 0 :
       points=0;
   elif num >= 1 and num <= 3:
       points = 5 * num;
   elif num > 3 and num <= 6:
       points = 10 * num;
   elif num > 6 and num <= 8:
       points = 15 * num;
   elif num >= 9:
       points = 20 * num;
       #print the result as requested
   print(str(FirstName) +' '+ str(LastName)+' has earned '+str(points)+' '+'points')
   game_active = int(input('Please enter 1 to rerun or 0 to exit:'))

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
In this assignment, you will develop a Python program that will process applications for gala-type events...
In this assignment, you will develop a Python program that will process applications for gala-type events at a local dinner club. The club, Gala Events Inc., is currently booking events for the upcoming holidays. However, the club has the following restrictions: Due to the physical size of the building, its maximum occupancy for any event is 100—not including the club staff. Since local regulations do not permit the sale of alcoholic beverages after midnight, the maximum length of any event...
Suppose you are a salesperson and your company's CRM forecasts that your quarterly sales will be...
Suppose you are a salesperson and your company's CRM forecasts that your quarterly sales will be substantially under quota. You call your best customers to increase sales, but no one is willing to buy more. Your boss says that it has been a bad quarter for all the salespeople. It's so bad, in fact, that the vice president of sales has authorized a 20 percent discount on new orders. The only stipulation is that customers must take delivery prior to...
Suppose you are a salesperson and your company's CRM forecasts that your quarterly sales will be...
Suppose you are a salesperson and your company's CRM forecasts that your quarterly sales will be substantially under quota. You call your best customers to increase sales, but no one is willing to buy more. Your boss says that it has been a bad quarter for all the salespeople. It's so bad, in fact, that the vice president of sales has authorized a 20 percent discount on new orders. The only stipulation is that customers must take delivery prior to...
Suppose you are a salesperson and your company's CRM forecasts that your quarterly sales will be...
Suppose you are a salesperson and your company's CRM forecasts that your quarterly sales will be substantially under quota. You call your best customers to increase sales, but no one is willing to buy more. Your boss says that it has been a bad quarter for all the salespeople. It's so bad, in fact, that the vice president of sales has authorized a 20 percent discount on new orders. The only stipulation is that customers must take delivery prior to...
After reading the following article, how would you summarize it? What conclusions can be made about...
After reading the following article, how would you summarize it? What conclusions can be made about Amazon? Case 12: Amazon.com Inc.: Retailing Giant to High-Tech Player? (Internet Companies) Overview Founded by Jeff Bezos, online giant Amazon.com, Inc. (Amazon), was incorporated in the state of Washington in July 1994, and sold its first book in July 1995. In May 1997, Amazon (AMZN) completed its initial public offering and its common stock was listed on the NASDAQ Global Select Market. Amazon quickly...