You are on page 1of 8

Project

Subject:
OOP
Submitted To:
Adnan Waheed
Submitted By:
Shawaz ul Rehman(0022-BSCS-
2019)
Ahsan Raza(0006-BSCS-2019)
Department:
CS&IT
2nd Semester
UON Narowal
Coffee Shop Management System
Coding :
#include<iostream>
#include<iomanip>
#include<string>
#include<fstream>
using namespace std;
struct Coffee
{
int a, b, t = 0, ca[100] = { 0 }, pa, c = 0, cp[100] = { 0 };
string o[50] = { "\0" };
int s[50], r = 0, co;
string pass = "CS2nd", p;
int It[15] = { 1,2,3,4,5,6,7,8,9 };
int P[15] = { 120,100,900,70,150,200,700,300,250 };
int Q[15] = { 35,20,10,15,25,30,12,20,17 };
char N[15][20] = { "Americano","Latte","Cappuccino","
Espresso","Irish","Affogato","Mochachino","Macchiato","Flat White" };
};
void show();
void menu();
void admin();
void count(Coffee *);
void item(Coffee *);
void order(Coffee *);
void back(Coffee *);
void Add(Coffee *);
void Delete(Coffee *);
void main()
{
int i, x, y = 0, z;
Coffee s;
show();
menu:
menu();
cin >> x;
if (x == 1)
{
list:
item(&s);
cin >> i;
{
if (i == 0)
{
goto menu;
}
else if (i <= 15 && i>0)
{

for (int j = 0; j < s.co; j++)


{
if (i == s.It[j])
{
z = j;
}
}
if (s.It[z] == i&&s.Q[z]>0)
{
cout << "Enter Item Quantity : " << endl;
cin >> s.a;
s.b = s.a*s.P[z];
cout << "Item you Selected is : " << s.N[z] << endl;
cout << "It's Price is : " << s.b << endl;
cout << "1. Conform It\n2. Item List" << endl;
cin >> x;
if (x == 1)
{
int u;
cout << "Payment By\n\t1.Cash\n\t2.Credit Card"
<< endl;
cin >> u;
s.o[s.r] = s.N[z];
s.Q[z] = s.Q[z] - s.a;
s.s[s.r] = s.Q[z];
++s.r;
if (u == 1)
{
s.t = s.t + s.b;
}
else
{
cout << "Enter Credit Card Number : " <<
endl;
cin >> s.ca[s.c];
cout << "Enter Credit Card Pin : " <<
endl;
cin >> s.pa;
s.cp[s.c] = s.b;
s.c++;
s.t = s.t + s.b;
}
cout << "\n\t\t\tThank You!!!!" << endl;
cout << "\n1.More Order\n2.Main Menu" << endl;
cin >> x;
if (x == 1)
{
goto list;
}
else
{
goto menu;
}
}
else
{
goto list;
}
}
else if (x == 2)
{
goto list;
}
else
{
cout << "\n\nSorry This Coffee has Ended!!!" << endl;
cout << "Please Select Other Coffee\n\n" << endl;
goto list;
}
}
else
{
goto list;
}

goto menu;
}
}
else if (x == 2)
{
cout << "Enter Password : " << endl;
cin >> s.p;

if (s.p != s.pass)
{
int u = 3;
while (u > 0)
{
cout << "Your Password is incorrect." << endl;
cout << "You have " << u << " tries left." << endl;
cout << "Enter Password : " << endl;
cin >> s.p;
u--;
if (s.p == s.pass)
goto admin;
}
}
admin:while (s.p == s.pass)
{
int e;
admin();
cin >> e;
if (e == 1)
{
cout << "Total Cash Today is : " << s.t << endl;
cout << "\n\n\n";
goto admin;
}
else if (e == 2)
{
cout << "| Card Number | Card Payments |" << endl;
for (int u = 0; u < s.c; u++)
{
cout << "| " << s.ca[u] << " | " << s.cp[u] <<
" |" << endl;
}
cout << "\n\n\n";
goto admin;
}
else if (e == 3)
{
Add(&s);
goto admin;
}
else if (e == 4)
{
Delete(&s);
goto admin;
}
else if (e == 5)
{
count(&s);
item(&s);
goto admin;
}
else if (e == 6)
{
count(&s);
cout << endl;
cout << "Total Items are : " << endl;
cout << "\t\t\t" << s.co << endl;
goto admin;
}
else if (e == 7)
{
back(&s);
goto admin;
}
else if (e == 8)
{
order(&s);
goto admin;
}
else if (e == 0)
{
goto menu;
}
else
{
cout << "You Entered Invalid." << endl;
}
goto admin;
}
}
else if (x == 3)
{
exit(0);
}
else
{
cout << "You Entered Invalid." << endl;
}
system("pause");
}
void show()
{
cout << "\n\n\n";
cout << " " << setw(50) <<
"\t\t\t===========================================================" << endl;
cout << setw(4) << "\t\t\t||" << setw(46) << "
" << setw(6) << "||" << endl;
cout << setw(4) << "\t\t\t||" << " \tWelcome To Narowal Coffee Shop"
<< setw(7) << "||" << endl;
cout << setw(4) << "\t\t\t||" << setw(46) << "
" << setw(6) << "||" << endl;
cout << " " << setw(50) <<
"\t\t\t===========================================================" << endl;
cout << "\n\n\n" << endl;
}
void menu()
{
cout << "\t\t\t***Main Menu***" << endl;
cout << "\t\t\t1.Coffee List" << endl;
cout << "\t\t\t2.Admin Panel" << endl;
cout << "\t\t\t3.Exit" << endl;
cout << "\t\t\tSelect" << endl;
}
void admin()
{
cout << "\t\t\t***Admin Panel***" << endl;
cout << "\n\t\t\t1. Total Cash Today ";
cout << "\n\t\t\t2. View Card Pay";
cout << "\n\t\t\t3. Add Coffee Item";
cout << "\n\t\t\t4. Delete Item";
cout << "\n\t\t\t5. Instant Item List";
cout << "\n\t\t\t6. Item Counter";
cout << "\n\t\t\t7. Backup System";
cout << "\n\t\t\t8. Instant Order Preview";
cout << "\n\t\t\t0. Main Menu";
cout << "\n\t\t\tSelect";
cout << endl;
}
void item(Coffee *s)
{
count(s);
cout << "\t\t\t***Coffee List***" << endl;
cout << "\t\t\t_________________________________________" << endl;
cout << "\t\t\t|Item No.| Item Name | Price |In Stock|" << endl;
cout << "\t\t\t-----------------------------------------" << endl;
for (int u = 0; u < s->co; u++)
{
cout << "\t\t\t| " << s->It[u];
cout << " | " << s->N[u];
cout << " | " << s->P[u];
cout << " | " << s->Q[u];
cout << " |" << endl;
cout << "\t\t\t-----------------------------------------" << endl;
}
cout << "\t\t\t>> 0 For Main Menu" << endl;
cout << "\t\t\tSelect" << endl;
}
void count(Coffee *s)
{
if (s->It == '\0')
{
s->co = 0;
}
else
{
s->co = 0;
for (int u = 0; u < 15; u++)
{
if (s->It[u] != '\0')
{
s->co++;
}
}
}
}
void order(Coffee *s)
{
cout << "\t\t\t__________________________________" << endl;
cout << "\t\t\t|Order No.| Coffee Name |In Stock|" << endl;
for (int u = 0; u < s->r; u++)
{
cout << "\t\t\t| " << u + 1;
cout << " | " << s->o[u];
cout << " | " << s->s[u] << " |";
cout << endl;
}
cout << "\n\n\n";
}
void back(Coffee *c)
{
ofstream f;
char date[35] = __DATE__;
strcat_s(date, ".txt");
f.open(date);
{
f << "Total Cash Today :\n\t\t\t ";
f << c->t;
f << endl;
f << "Card Number----------Card Money";
f << endl;
for (int i = 0; i < c->c; i++)
{
f << c->ca[i];
f << "---------------";
f << c->cp[i];
f << endl;
}
cout << "Backup SuccessFul!!!!\n\n\n" << endl;
}
f.close();
}
void Add(Coffee *c)
{
int i, x = 0;
cout << "Enter Item Number : " << endl;
cin >> i;
count(c);
for (int j = 0; j < c->co; j++)
{
if (i == c->It[j])
{
cout << "Item Number is Already Exit" << endl;
x = i;
}
}
if (i != x)
{
c->It[c->co] = i;
cout << "Enter Coffee Name : " << endl;
cin >> c->N[c->co];
cout << "Enter Coffee Price : " << endl;
cin >> c->P[c->co];
cout << "Enter Coffee Quantity : " << endl;
cin >> c->Q[c->co];
cout << "\n\n\t\t\tData Submit Successfully!!!!\n\n" << endl;
}
else
{
Add(c);
}
}
void Delete(Coffee *c)
{
int pos, i;
cout << "Enter Item Number For Delete : " << endl;
cin >> i;
for (int j = 0; j < c->co; j++)
{
if (i == c->It[j])
{
pos = j;
for (int i = pos; i <= c->co - 1; i++)
{
c->It[i] = c->It[i + 1];
c->Q[i] = c->Q[i + 1];
for ( j = 0; j < 20; j++)
{
c->N[i][j] = c->N[i + 1][j];
}
c->P[i] = c->P[i + 1];
}
cout << "\n\n\t\t\tItem Delete Successfully!!!!" << endl;
}
}
}

You might also like