Question
Write a Java application that prompts the user for pairs of inputs of a product number (1-5), and then an integer quantity of units sold
Write a Java application that prompts the user for pairs of inputs of a product number (1-5), and then an integer quantity of units sold (this is two separate prompts for input values). You must use a switch statement and a sentinel-controlled loop (i.e. a loop that stops execution when an out of range value, such as -1, is input). All 15 items below are for a single purchase. There are five sets of inputs as follows:
Product 1 1 unit (cost is $2.98 per unit)
Product 2 2 units (cost is $4.50 per unit)
Product 3 3 units (cost is $9.98 per unit)
Product 4 4 units (cost is $4.49 per unit)
Product 5 5 units (cost is $6.87 per unit)
Your application must show the users input of each pair of product number and quantity, the calculated line cost for that product, and the cumulative order cost so far. Then, after the sentinel value is input your program must display the total retail cost for the full order.
You must show all 11 user inputs (5 product number and quantity pairs and the sentinel value) and all the corresponding program outputs, not just a subset of the inputs and outputs.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started