-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprice_calc.cxx
54 lines (53 loc) · 1.4 KB
/
price_calc.cxx
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
// price milestone calculator
//::@Gofaone315
//::https://github.com/Gofaone315
#include<iostream>
using namespace std;
int main()
{
float child_meal;
float adult_meal;
int child_number;
int adult_number;
cout<<"What's the price of children's meal?"<<endl;
cin>>child_meal;
cout<<"What's the price of adults meal?"<<endl;
cin>>adult_meal;
cout<<"How many children are there?"<<endl;
cin>>child_number;
cout<<"How many adults are there?"<<endl;
cin>>adult_number;
float child_cost;
float adult_cost;
child_cost = child_number * child_meal;
adult_cost = adult_number * adult_meal;
float subtotal;
subtotal = child_cost + adult_cost;
cout<<"subtotal: "<<subtotal<<endl;
float sales_tax_rate;
cout<<"What is the sales tax rate?"<<endl;
cin>>sales_tax_rate;
float sales_tax;
sales_tax = (subtotal*sales_tax_rate)/100;
cout<<"Sales Tax: "<<sales_tax<<endl;
float total_price;
total_price = sales_tax + subtotal;
cout<<"Total Price: "<<total_price<<endl;
float payment;
cout<<"What's the payment amount?"<<endl;
cin>>payment;
float change;
change = payment - total_price;
if (change == 0)
{
cout<<"Thank you for buying at our shop, Goodbye!";
}
else if (change < 0)
{
cout<<"Money short with: "<<change/-1<<endl;
}
else
{
cout<<"change: "<<change;
}
}