- #1
nukeman
- 655
- 0
Homework Statement
My computer crashed, so I can't check my code I wrote, and the school linux lab is full, so I really need some help.
I already wrote the code (ill post it below) so I can't compile it and check for some errors. Can anyone quickly glance it over and see any mistakes?
The program will read a regular price from standard input and output a saleslip.
Here is the code:
//This program computes a regular price from standard input
//and outputs a saleslip
#include (isostream>
using namespace std;
int main()
{
const int HST_RATE = 12;
double priceItem, total, per, sp, hst, dis;
char sale;
cout << " " << endl;
cout << " This program calculates the total cost of some items " << endl;
cout << " Enter the Regular Price " ;
cin >> priceItem;
Cout << " Is this item on Sale (Y/N)? "
cin << sale;
if ( sale == 'y' or sale == 'Y')
{
cout << "Enter the percent discount: "
cin << per;
dis = (per/100) * price;
sp price - dis;
hs = (HST_RATE/100) * sp;
total = sp + hst;
cout << "Sale Slip" << endl,
cout << "===" << endl;
cout "Regular Price $: " << price << endl;
cout << "Discount $: " << dis << endl;
cout << " Sale Price $: " << so << endl;
cout << "HST $: " << hst << endl;
cout << "Total $: " << total << endl;
}
else
{
hst = (HST_RATE/100) * price;
total = price + hst;
cout << "Sale Slip" << endl;
cout << "===" << endl;
cout << "Regular Price $ " << price << endl;
cout << "HST $ << hst << endl;
cout << "Total $ " << total << endl;
}
cout << " " << endl;
return 0;
}