Question: Write a java programm Problem 2: Sales A mail-order house sells five products whose retail prices are as follows: Product 1, $2.98; product 2, $4.50;

Write a java programm

Write a java programm Problem 2: Sales A mail-order house sells five

Problem 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. Format your output as shown in the sample below. Sample Input file (call it sales.txt) 1 Pen 2 Pencil case 3 A4 paper pack 4 Stapler 5 Coloring book Sample 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!