This exercise requires designing a program which solves the problem described in the problem statement below. Provide comments for your pseudo-code and Java program as necessary.
1.Asks the user to enter the number of books that they have purchased this month. 2.Displays the number of points awarded. 3.If the user enters a value less than 0, it will display an error message and will not display any points.
Serendipity Booksellers has a book club that awards points to its customers based on the number of books purchased each month. The points are awarded, as shown below. If the customer purchases:
0 books, they earn 0 points
1 book, they earn 5 points
2 books, they earn 15 points
3 books, they earn 30 points
4 or more books, they earn 60 points.
Your program should contain the following:
Module main. Asks the user how many books were purchased. Passes the number of books purchased to pointsEarned.
Module pointsEarned. Uses a decision statement to determine the number of points earned based on the number of books purchased.
Expected Output
How many books did you purchase? 10 You earned 60 points.
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly complete the form.
Please provide a valid email address and we will get back to you within 24 hours.
Payment is through PayPal, Buy me a Coffee
or Cryptocurrency.
We are a nonprofit organization however we need funds to keep this organization operating
and to be able to complete our research and development projects.