Help making a reciept

This program is not finished. I'm trying to make a receipt program for class that will allow the user to choose three different items. If the user selects at least 1 of each item, then a 20% discount is applied. There is also an 8.25% tax rate. My finished receipt is supposed to show the number of each item the user selected, along with the money saved and the total. I'm confused about how I would add in the tax rate,and how I would show the user their savings.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
 
	ifstream inFile;
	inFile.open("myHEB.txt");
	string item1, item2, item3;
	double price1, price2, price3;
	int qty1, qty2, qty3;
	double total;
	double tot1,tot2,tot3;
	//input data from file first
	inFile>>item1>>price1;
	inFile>>item2>>price2>>item3>>price3;

	inFile.close();  //close the file.

	cout<<"The following are the items available"<<endl;
	cout<<"1.  "<<left<<fixed<<setprecision(2)<<setw(10)<<item1<<price1<<endl;
	cout<<"2.  "<<setw(10)<<item2<<price2<<endl;
	cout<<"3.  "<<right<<setw(10)<<item3<<price3<<endl;
	cout<<"How many "<<item1<<" do you want to buy?"<<endl;
	cin>>qty1;
	cout<<"How many "<<item2<<" do you want to buy?"<<endl;
	cin>>qty2;
	cout<<"How many "<<item3<<" do you want to buy?"<<endl;
	cin>>qty3;

	if (qty1>=1)
	{
		tot1= qty1*price1*.80;
	}
	else 
	{ 
		tot1=qty1*price1;
	}
	if (qty2>=1)
	{ 
		tot2= qty2*price2*.80;
	}
	else
	{
		tot2= qty2*price2;
	}
	if (qty3>=1)
	{
		tot3= qty3*price3*.80;
	}
	else 
	{ 
		tot3=qty3*price3;
		
	}

	//calculations
	
	cout<<setw(10)<<item1<<"   ("<<setw(4)<<price1<<")   x  "<<qty1<<"   ="<<tot1<<endl;
	cout<<setw(10)<<item2<<"   ("<<setw(4)<<price2<<")   x  "<<qty2<<"   ="<<tot2<<endl;
	cout<<setw(10)<<item3<<"   ("<<setw(4)<<price3<<")   x  "<<qty3<<"   ="<<tot3<<endl;
	total = (tot1+tot2+tot3);  // calculate total
	
	cout<<"_________________________________"<<endl;

	cout<<"Total                         "<<total<<endl;


	return 0;
Topic archived. No new replies allowed.