Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise#2: Sales 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,

image text in transcribed
Exercise#2: Sales 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 a Java program that reads a series of pairs as follows: product number and product name. The quantity sold is generated at random between 0 and 50. 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 as shown in the sample output. The loop should stop looping when there is no input. The input is stored in an input file. Sample Input file (call it sales.txt) 1 Pen 2 Pencil case 3 A4 paper pack 4 Stapler 5 Coloring book ample Output Product 1: Product 2: Product 3: Product 4: Product 5: Pen Pencil case A4 paper pack Stapler Coloring book 9 $26.82 45 $229.32 21 $438.90 37 $605.03 24 $769.91 Total Sales: $2069.98

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

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Why could the Robert Bosch approach make sense to the company?

Answered: 1 week ago