I will also attach the code I made. Any suggestions. Im sure there is something wrong with my while command. But I believe there is something else I have to add to print out the last customer name: quit output. I am stumped at the moment.
Lab 28 – Your Name
Input Customer Name: xxxxxxxxxx
Input Customer State: xx
Input Product Price: xxx.xx
Customer Name: xxxxxxxxxxx
Customer State: xx
Product Price: xxx.xx
Product Discount: xxx.xx
Discounted Price: xxx.xx
Sales Tax: xx.xx
Total Cost: xxx.xx
Input Customer Name: Quit
End of Lab 28 for Your Name
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
double pPrice , pDiscount , dPrice , sTax , tCost ;
int cName , cState ;
int main()
{
cout << "Lab 28 - Pedro Mendez" ;
cout << endl ;
cout << endl ;
cout << "Input Customer Name: " ;
cin >> cName ;
cout << "Input Customer State: " ;
cin >> cState ;
cout << "Input Product Price: " ;
cin >> pPrice ;
cout << endl ;
cout << endl ;
// begin loop
while (cName != "Quit")
if (pPrice > 50)
pDiscount = pPrice *0.15 ;
else pDiscount = 0 ;
dPrice = pPrice - pDiscount ;
sTax = dPrice * 0.07 ;
tCost = dPrice - sTax ;
// begin outputting
cout << "Customer Name: " << cName ;
cout << endl ;
cout << "Customer State: " << cState ;
cout << endl ;
cout << "Product Price: " << pPrice ;
cout << endl ;
cout << "Discounted Price: " << pDiscount ;
cout << endl ;
cout << "Sales Tax: " << sTax ;
cout << endl ;
cout << "Total Cost: " << tCost ;
cout << endl ;
cout << endl ;
}

New Topic/Question
Reply


MultiQuote



|