You are writing a program for a bookstore that has a membership rewards program. This membership program has two versions: a free version and a paid version. Both free and paid members receive points when making purchases, and paid members also receive a 10% discount on their total order. Customers who are not a part of the membership program receive no rewards. Have your program run in a continuous while loop until the user decides to quit. Create a variable before the while loop called grand_total, initialized to 0. Each time a sale is entered, you will add the total to that variable. At the start of each loop iteration, the user has three options: Enter a new customer sale into the system. Ask how many books the customer is buying. Ask for the subtotal cost of the books, before tax. Ask whether the customer is a free member, paid member, or non-member. Calculate 9.25% of the subtotal cost to be the amount for taxes and add that amount to the subtotal to calculate the final cost. If the customer is a paid member, remove 10% of the subtotal cost from the final cost. (Note: The tax amount is not discounted) Add the final cost to the grand_total variable. Determine how many points the customer will receive for this purchase. If the customer is not a member, they receive 0 points. Otherwise, the number of points earned by the customer is based on the following list: If 1 book is purchased, all members earn 5 points. If 2 books are purchased, all members earn 15 points. If 3 books are purchased: Paid members earn 50 points Free members earn 30 points If 4 or more books are purchased Paid members earn 100 points Free members earn 60 points Display the following, one per row: # books the customer is purchasing, the subtotal, the tax amount, the final cost, the amount saved (only if they are a paid member, otherwise do not print this row), and po

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter12: Exception Handling
Section: Chapter Questions
Problem 1GZ
icon
Related questions
Question

You are writing a program for a bookstore that has a membership rewards program. This membership program has two versions: a free version and a paid version. Both free and paid members receive points when making purchases, and paid members also receive a 10% discount on their total order. Customers who are not a part of the membership program receive no rewards.

Have your program run in a continuous while loop until the user decides to quit. Create a variable before the while loop called grand_total, initialized to 0. Each time a sale is entered, you will add the total to that variable. At the start of each loop iteration, the user has three options:

  1. Enter a new customer sale into the system.
    • Ask how many books the customer is buying.
    • Ask for the subtotal cost of the books, before tax.
    • Ask whether the customer is a free member, paid member, or non-member.
    • Calculate 9.25% of the subtotal cost to be the amount for taxes and add that amount to the subtotal to calculate the final cost.
    • If the customer is a paid member, remove 10% of the subtotal cost from the final cost. (Note: The tax amount is not discounted)
    • Add the final cost to the grand_total variable.
    • Determine how many points the customer will receive for this purchase. If the customer is not a member, they receive 0 points. Otherwise, the number of points earned by the customer is based on the following list:
      • If 1 book is purchased, all members earn 5 points.
      • If 2 books are purchased, all members earn 15 points.
      • If 3 books are purchased:
        • Paid members earn 50 points
        • Free members earn 30 points
      • If 4 or more books are purchased
        • Paid members earn 100 points
        • Free members earn 60 points
    • Display the following, one per row: # books the customer is purchasing, the subtotal, the tax amount, the final cost, the amount saved (only if they are a paid member, otherwise do not print this row), and points received for this purchase. Make sure to format this information nicely.
  2. See how much money the store has made today.
    • Print out how much money the store has made today (by printing the grand_total variable)
  3. Quit the program.
    • Exit out of the while loop at this point. Before closing the program, print out how much money the store made today
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Types of Loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,