-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbillproject.cpp
More file actions
98 lines (91 loc) · 2.07 KB
/
billproject.cpp
File metadata and controls
98 lines (91 loc) · 2.07 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include<iostream>
using namespace std ;
int m = 40;
class shop{
int itemCode[50];
float itemPrice[50];
int count;
public:
void CNT(){
count = 0;
}
void getItem();
void displaySum();
void remove();
void displayItems();
};
void shop :: getItem(){
cout<<"Enter the Item Code : ";
cin>>itemCode[count];
cout<<"Enter the Item Cost : ";
cin>>itemPrice[count];
count++;
}
void shop :: displaySum(){
float sum= 0;
for(int i = 0 ; i < count ;i++){
sum = sum + itemPrice[i];
cout<<"\n Total Value is :"<<sum<<"\n";
}
}
void shop :: remove(){
int a ;
cout<<"Enter the Item Code :";
cin>>a;
for(int i = 0 ; i < count ; i++){
if(a==itemCode[i]){
itemCode[i]=0;
}
}
}
void shop :: displayItems(){
cout<<"\n Code Price \n";
for(int i = 0 ; i < count ; i++){
cout<<itemCode[i]<<"\t";
cout<<itemPrice[i];
}
cout<<"\n";
}
int main(){
int option;
shop sp;
sp.CNT();
do{
cout<<"choose any of the following option:"<<"\n";
cout<<"1. Add items"<<"\n";
cout<<"2. Display Total Bill"<<"\n";
cout<<"3. Remove Items"<<"\n";
cout<<"4. Display All Items"<<"\n";
cout<<"5. Total Items"<<"\n";
cout<<"6. Quit"<<"\n";
cin>>option;
switch(option){
case 1 :
cout<<"Add-items \n";
sp.getItem();
break;
case 2:
cout<<"Display total bill \n";
sp.displaySum();
break;
case 3 :
cout<<"Remove Items \n";
sp.remove();
break;
case 4:
cout<<"Display all items \n";
sp.displayItems();
break;
case 5:
cout<<"Total items \n";
sp.displayItems();
break;
case 6:
cout<<"quit";
break;
default:
cout<<"please select an valid option";
}
}
while(option!=6);
}