Sunteți pe pagina 1din 8

CUSTOMER.

H
#include<iostream>
#include<string>
using namespace std;
#pragma once

class customer
{
int id[14];
string name[50];
string location[50];
public:
customer();
~customer(void);
customer(const customer &);
void cusdisplay();
friend istream &operator >>(istream &cin , customer &S);
void getdata();

};
CUSTOMER.CPP
#include "customer.h"
#include<iostream>
#include<string>
using namespace std;

customer::customer()
{
id[14]=0;
name[50]="NULL";
location[50]="NULL";
}

customer::~customer(void)
{
}

customer::customer(const customer & x)


{
id[14]=x.id[14];
name[50]=x.name[50];
location[50]=x.location[50];
}

void customer::cusdisplay()
{
cout<<"Customer Name :"<<name[50]<<endl;
cout<<"Customer ID :"<<id[14]<<endl;
cout<<"Customer Location :"<<location[50]<<endl;
}

void customer::getdata()
{
cout<<"enter name";
cin>>name[50];
cout<<"enter id";
cin>>id[14];
cout<<"enter location";
cin>>location[50];
if(location[50] != "Islamabad" && location[50] != "Rawalpindi")
{
cout<<"WE ONLY DELIEVER AT ISLAMABAD AND RAWALPINDI"<<endl;
}
}
EMPLOYEE.H

#include<iostream>
#include<string>
using namespace std;
#pragma once
class employee
{
string name[50];
int nic[14];

public:
employee();
employee(string n, int N);
~employee(void);
void display();

};
EMPLOYEE.CPP
#include "employee.h"
employee::employee()
{
name[50]="NULL";
nic[14]=0;
}

employee::employee(string n, int N)
{
name[50]=n;
nic[14]=N;
}

employee::~employee(void)
{
}

void employee::display()
{
cout<<"Name is"<<name[50]<<endl;
cout<<"NIC is"<<nic[14]<<endl;
}

ADMIN.H
#pragma once
#include "employee.h"
class admin:public employee
{
int id[14];
string username,password;
int amount;

public:
admin();
admin(string n, int N, int i);
~admin(void);
int currentamount(int c);
int totalamount();
bool login();
void display();
};
ADMIN.CPP
#include "admin.h"
#include "employee.h"
admin::admin()
{
id[14]=0;
username="NULL";
password="NULL";
amount=0;
}

admin::admin(string n, int N, int i):employee( n, N)


{
id[14]=i;
}

admin::~admin(void)
{
}

int admin::currentamount(int c)
{
amount=amount+c;
cout<<"Current bill is";
return amount;
}
int admin::totalamount()
{
cout<<amount;
return amount;
}
bool admin::login()
{
string ausername="vaneeza";
string apassword="password";
cout<<"enter your username";
cin>>username;
cout<<"enter your password";
cin>>password;

if(username == ausername && password == apassword)


{
return true;
cout<<"LOGIN SUCCESSFULL \n WELCOME";
}
else
{
return false;
cout<<"LOGIN FAILED";
}
}
void admin::display()
{
employee::display();
cout<<"ID is"<<id[14];
}

MENU.H
#include "customer.h"
#include "admin.h"
#include<iostream>
#include<string>
using namespace std;
#pragma once
class menu
{
admin a1;
customer c1;
int count;
public:
void showmenu();
menu();
~menu(void);
};

MENU.CPP
#include "menu.h"
#include "customer.h"
#include "admin.h"
menu::menu()
{
count=0;
}
menu::~menu(void)
{
}

void menu::showmenu()
{
int a=0;
do
{
cout<<"WELCOME TO JADE CAFE"<<endl;
cout<<"The finest cafe in Town"<<endl;
cout<<"****MENU****"<<endl;
cout<<"| 1) Appetizers \t |"<<endl;
cout<<"| 2) Main Course \t |"<<endl;
cout<<"| 3) Drinks \t |"<<endl;
cout<<"| 4) Dessert \t |"<<endl;
cout<<"| 5) Checkout \t |"<<endl;
cout<<"| 6) Reset Cart \t |"<<endl;
cout<<"| 7) Exit \t |"<<endl;
cout<<"Choose from the menu"<<endl;
cin>>a;
if(a==1)
{
int b=0;
cout<<"APPETIZERS"<<endl;
cout<<" | 1) Garlic Bread $20 \t |"<<endl;
cout<<" | 2) Meatballs $20 \t |"<<endl;
cout<<" | 3) Soup\t $40|"<<endl;
cout<<"choose Appetiser"<<endl;
cin>>b;
if(b==1)
{
cout<<"Garlic bread $20";
a1.currentamount(20);
}

if(b==2)
{
cout<<"Meatballs $20";
a1.currentamount(20);
}
if(b==3)
{
cout<<"Soup\t $40";
a1.currentamount(40);
}
else
cout<<"INVALID INPUT";
}

if(a==2)
{
cout<<"MAIN COURSE"<<endl;
cout<<" | 1) Steak $40\t |"<<endl;
cout<<" | 2) Spaghetti $50\t |"<<endl;
cout<<" | 3) Lasagna $60\t |"<<endl;
cout<<" | 4) Meatloaf $40\t |"<<endl;
cout<<" | 5) Grilled Chicken $40\t |"<<endl;
int b=0;
cout<<"Choose Main course";
cin>>b;
if(b==1)
{
cout<<" 1) Steak $40\t "<<endl;
a1.currentamount(40);
}

if(b==2)
{
cout<<"2) Spaghetti $50\t "<<endl;
a1.currentamount(50);
}
if(b==3)
{
cout<<"3) Lasagna $60\t "<<endl;
a1.currentamount(60);
}
if(b==4)
{
cout<<"4) Meatloaf $40\t "<<endl;
a1.currentamount(40);
}
if(b==5)
{
cout<<"5) Grilled Chicken $40\t "<<endl;
a1.currentamount(40);
}
else
cout<<"INVALID INPUT";
}

if(a==3)
{
int b=0;
cout<<"DRINKS"<<endl;
cout<<" | 1) Water $10 \t |"<<endl;
cout<<" | 2) Tea $20 \t |"<<endl;
cout<<" | 3) Coffee $30 \t |"<<endl;
cout<<" | 4) Coke $10 \t |"<<endl;

cout<<"Choose Drink";
cin>>b;
if(b==1)
{
cout<<" 1) Water $10 \t "<<endl;
a1.currentamount(10);
}

if(b==2)
{
cout<<"2) Tea $20 \t "<<endl;
a1.currentamount(20);
}
if(b==3)
{
cout<<"3) Coffee $30 \t "<<endl;
a1.currentamount(30);
}
if(b==4)
{
cout<<"4) Coke $10 \t "<<endl;
a1.currentamount(10);
}

else
cout<<"INVALID INPUT";
}

if(a==4)
{
int b=0;
cout<<"DESERTS"<<endl;
cout<<" | 1) Icecream $20 \t |"<<endl;
cout<<" | 2) Fruit Salad $40 \t |"<<endl;
cout<<" | 3) Molten Lava Cake $30 \t |"<<endl;
cout<<"Choose Desert";
cin>>b;
if(b==1)
{
cout<<" 1) Icecream $20 \t "<<endl;
a1.currentamount(20);
}

if(b==2)
{
cout<<"2) Fruit Salad $40 \t "<<endl;
a1.currentamount(40);
}
if(b==3)
{
cout<<"3) Molten Lava Cake $30 \t "<<endl;
a1.currentamount(30);
}
else
cout<<"INVALID INPUT";
}
if(a==5)
{
int finalamount;
cout<<"Total bill is"<<a1.totalamount();
cout<<"**DISCOUNTS**"<<endl;
cout<<"1) 20% on more than $100"<<endl;
cout<<"2) 10% on more than $80"<<endl;
cout<<"3) 5% on more than $70"<<endl;
if(a1.totalamount()>100)
{
cout<<"Discount applied is : 1) 20% on more than $100"<<endl;
finalamount=(20/100)*a1.totalamount();
cout<<"FINAL BILL IS"<<finalamount;
}
if(a1.totalamount()>=80 && a1.totalamount()<100)
{
cout<<"Discount applied is : 2) 10% on more than $80"<<endl;
finalamount=(10/100)*a1.totalamount();
cout<<"FINAL BILL IS"<<finalamount;
}
if(a1.totalamount()>=70 && a1.totalamount()<80)
{
cout<<"Discount applied is : 3) 5% on more than $70"<<endl;
finalamount=(5/100)*a1.totalamount();
cout<<"FINAL BILL IS"<<finalamount;
}
}
if(a==6)
{
}

if(a==7)
{
exit(1);
}
}
while(a!=7);
}
SOURCE.CPP
#include "menu.h"
#include "customer.h"
#include "admin.h"
#include "employee.h"
#include<iostream>
#include<string>
using namespace std;
int main()
{
admin a3("Ali" , 45678, 01);
a3.login();
customer c2;
c2.getdata();
menu m1;
m1.showmenu();
system ("pause");
return 0;
}

S-ar putea să vă placă și