Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help, need a java code for this problem and I need a flowchart as well. It can not be Python. Problem Statement Design a program

Help, need a java code for this problem and I need a flowchart as well. It can not be Python.

Problem Statement

Design a program that

  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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is the preferred personality?

Answered: 1 week ago