In a C# create A website sells three products whose retail prices are as follows
ID: 3532284 • Letter: I
Question
In a C# create A website sells three products whose retail prices are as follows: product 1, $2.98; product 2 $4.50; and product 3, $9.98. Write an application that reads a series of pairs of numbers as follows: a) product number b) quantity sold Your application 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 application should stop looping display the final results
Explanation / Answer
static void Main(string[] args) { double retail; double ProdPrice; double ProdQuan; string ProdNumber; Console.Write("Enter product number 1, 2 or 3: "); ProdNumber = Console.ReadLine (); switch (ProdNumber.ToUpper()) { case "1": ProdPrice = 2.98; break; case "2": ProdPrice = 4.50; break; case "3": ProdPrice = 9.98; break; } Console.Write("Enter product quantity:"); ProdQuan = Convert.ToInt32(Console.ReadLine()); if (ProdQuan > 0) { retail = ProdPrice * ProdQuan;Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.