a mail order house sells five different products whose retail prices are: product 1 - $2.98,product 2- $4.50, product 3 - $9.98, product 4 -$4.49 and product 5 - $6.87. write a program that reads a series of pairs of numbers as follows:
a) product number
b) quantity sold
your program should calculate and display the total retail value of all products sold. use a sentinel-controlled loop to determine when the program should stop looping and display the final result.
Hi guys, i am a beginner on c++ and i need help on this assignment.
Any help will be appreciate.
#include<iostream>
using namespace std;
int main()
{
float Sales, TotalSales=0, ProductPrice;
int Qty;
int PCode;
cout << "please enter the product number from 1 to 5\n";
cin >> Sales;
cout << "please enter quantity.\n";
cin >> Qty;
switch (PCode)
{
case '1': PCode=1;
ProductPrice=2.98;
case '2': PCode=2;
ProductPrice=4.50;
case '3': PCode=3;
ProductPrice=9.98;
case '4': PCode=4;
ProductPrice=4.49;
case '5': PCode=5;
ProductPrice=6.87;
case '0': PCode=0;
exit;
default: cout << "Invalid entry, please enter a number from 1 to 5\n";break;
}
Sales= ProductPrice*Qty;
cout << "Your Sales is "<<Sales<<endl;
cout << "Please enter another product number.\n";
cin >> PCode;
cout << "Please enter quantity\n.";
cin >> Qty;
TotalSales=TotalSales + Sales;
}
cout << "Your Total Sales is $ "<< TotalSales <<endl;