-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbillingsystem.cpp
More file actions
170 lines (127 loc) · 4.26 KB
/
Copy pathbillingsystem.cpp
File metadata and controls
170 lines (127 loc) · 4.26 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
//header files
#include<iostream>
#include<fstream> // File handling operations
using namespace std;
class shopping
{
private: //private scope
int pcode; //declaring variables
float price;
float discount;
string pname;
public: //public scope
void menu(); //declaring functions - we will create definitions later
void administrator();
void buyer();
void add();
void edit();
void remove();
void list();
void receipt();
}; //; at end of class
//menu functon by mentioning class name and scope resolution operator
void shopping :: menu() // :: scope resolution operator
{
m: // Label for goto function at the beginning of menu function
int choice;
string email; // login credentials
string password;
// first we have to display supermarket main menu and then we can display administrator, buyer and stuff.
cout<<"/t/t/t/t/t___________________________\n ";
cout<<"/t/t/t/t/t \n ";
cout<<"/t/t/t/t/t SUPERMARKET MAIN MENU \n ";
cout<<"/t/t/t/t/t \n ";
cout<<"/t/t/t/t/t___________________________\n ";
cout<<"/t/t/t/t/t \n ";
cout<<"/t/t/t/t/t | 1) ADMINISTRATOR | \n ";
cout<<"/t/t/t/t/t | | \n ";
cout<<"/t/t/t/t/t | 2) BUYER | \n ";
cout<<"/t/t/t/t/t | | \n ";
cout<<"/t/t/t/t/t | 3) EXIT | \n ";
cout<<"/t/t/t/t/t | | \n ";
cout<<"/t/t/t/t/t Please Select!";
cin>>choice; //choice input
switch(choice)
{
case 1: //Administrator Case
cout<<"/t/t/t Please Login \n";
cout<<"/t/t/t Enter Email: \n";
cin>>email;
cout<<"/t/t/t Enter password: \n";
cin>>password;
// Admin details are unique. Only if they type these details, they will be logged in.
if(email== admin@gmail.com && password== Admin_4321)
adminstrator();
// If correct details are passed, tey enter the administrator function block.
else
cout<<"Invalid username/password";
break; //To end the case 1
case 2:
buyer();// We will just call buyer function.
case 3:
exit(0); // It means successful termination of the program.
default: //If a person selects anyother option.
cout<<"Please select from the given choices!";
}
goto m;
// goto function helps in jumping. Helps in going back to the main function again
}
void shopping :: administrator() // Next function definition
{
m: //label for goto
int choice;
cout<<"\n\n\n\t\t\t ADMINISTRATOR MENU";
cout<<"\n\t\t\t|______1)Add the product______|";
cout<<"\n\t\t\t| |";
cout<<"\n\t\t\t|_____2)Modify the product____|";
cout<<"\n\t\t\t| |";
cout<<"\n\t\t\t|_____3)Delete the product____|";
cout<<"\n\t\t\t| |";
cout<<"\n\t\t\t|_____4)Back to main menu_____|";
cout<<"\n\t\t\t| |";
cout<<"\n\n\t Please enter your choice ";
cin>>choice;
switch(choice)
{
case 1:
add(); // addition of new products by administrator.
break;
case 2:
edit(); // changes in present products made by administrator.
break;
case 3:
remove(); // removal of previous products by administrator.
break;
case 4:
menu();
break;
default :
cout<<"Invalid choice!";
}
goto m;
}
void shopping :: buyer()
{
m: //label
int choice;
cout<<"\n\n\n\t\t\t CUSTOMER ";
cout<<"\n ";
cout<<"\n\t\t\t1)Buy the product";
cout<<"\n ";
cout<<"\n\t\t\t|2)Go back ";
cout<<"\n ";
cout<<"\n\t Please enter your choice ";
cin>>choice;
switch(choice)
{
case 1:
receipt(); // Inside the receipt function, all the operations of buyers will take place.
break;
case 2:
menu();
break;
default:
cout<<"Please enter a valid choice!";
}
goto m;
}