Question: Java Programing Problem 2: Volume Discounts (10 points) Write a program that prompts the user for the number of items to be purchased and calculates
Java Programing
Problem 2: Volume Discounts (10 points)
Write a program that prompts the user for the number of items to be purchased and calculates the total cost based on the following pricing schedule:
| Number of items | Price per item |
| up to an including 15 items | $5.15 |
| Next 10 items | $4.75 |
| Any items over 25 | $3.75 |
For example, if the user enters 40 for the number of items, then the total cost would be $181.0 (i.e., 15 items at $5.15, 10 items at $4.75, and 15 items at $3.75)
You may assume that the user will always enter valid data, defined as a positive integer value. Additional requirements: use named constants for all cost components and round currency values to at
most 2 decimal places in your output.
Following are sample interactions that demonstrate how your program should work, with user input again shown in boldface (only in the handout, not in Eclipse). Be sure to test with a variety of inputs, including values that cover all boundary conditions (i.e., 14, 15 and 16; 24, 25, and 26).
Simple interaction 1:
This program prints the total cost of a purchase.
Enter the number of items purchased: 3
The total purchase price is: $15.45
Simple interaction 2:
This program prints the total cost of a purchase.
Enter the number of items purchased: 26
The total purchase price is: $128.5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
