-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJam.cpp
54 lines (46 loc) · 785 Bytes
/
Jam.cpp
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
#include<iostream>
using namespace std;
int main()
{
char package;
int jams=0;
int fee=0;
int includedjam=0;
int jamprice=0;
int totalcost;
cout<<"Enter the package u own "<<endl;
cin>>package;
cout<<"Enter the number of jams you have used "<<endl;
cin>>jams;
if(package=='A'||package=='a')
{
fee=8;
includedjam=2;
jamprice=5;
}
else if(package=='B'||package=='b')
{
fee=12;
includedjam=4;
jamprice=4;
}
else if(package=='C'||package=='c')
{
fee=15;
includedjam=6;
jamprice=3;
}
else
{
cout<<"Invalid package"<<endl;
}
if(jams>includedjam){
totalcost=fee+(jams-includedjam)*jamprice;
}
else
{
totalcost=fee;
}
cout<<"Your total cost is "<<totalcost<<endl;
return 0;
}