Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions