Question: 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

 Problem 2: Sales A mail-order house sells five products whose retail

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.67. 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 caso 3 A4 paper pack 4 Stapler 5 Coloring book Sample Output Product 1: Product 2: Product 3: Product 4: Product 5: Per 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 Problem 3: Monetary Units Write a Java program that converts a given amount of money into smaller monetary units. The program lets the user enter an amount as a String value representing the total amount in dirhams and fils, and outputs a report listing the equivalent monetary units in the maximum number of 1 dirham coins, 50 fils coins, 25 fils coins, and remaining fils if any. The program should result in the minimum number of coins. Read the input as a string such as "11.79". Your program should extract the dirham amount and the fils amount using the appropriate String methods Sample input/output Enter the amount: 11.79 Your amount 11.79 consists of: 11 dirham coins 1 50 fils coins 1 25 fils coins 4 remaining fils

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!