sample output: Enter product number (1-5) (0 to stop): 1 Enter quantity sold: 5 Enter product number (1-5) (0 to stop): 5 Enter quantity sold: 10 Enter product number (1-5) (0 to stop): 0 Product 1: $14.90 Product 2: $0.00 Product 3: $0.00 Product 4: $0.00 Product 5: $68.70

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question
100%

A mail-order house sells five products whose retail prices are as follows: Product 1, $2.98; product 2, $4.50; product
3, $9.98; product 4, $4.49 and product 5, $6.87. Write an application that reads a series of pairs of numbers
as follows:
a) product number
b) quantity sold
Your program should use a switch statement to determine the retail price for each product. It should calculate
and display the total retail value of all products sold. Use a sentinel-controlled loop to determine when the program
should stop looping and display the final results. give answer in java language

 

sample output:

Enter product number (1-5) (0 to stop): 1
Enter quantity sold: 5
Enter product number (1-5) (0 to stop): 5
Enter quantity sold: 10
Enter product number (1-5) (0 to stop): 0
Product 1: $14.90
Product 2: $0.00
Product 3: $0.00
Product 4: $0.00
Product 5: $68.70

Expert Solution
steps

Step by step

Solved in 2 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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr