CPP
CPP
// Address class
class Address
{
protected:
string sender_address;
string recipient_address;
public:
Address()
{
sender_address='\0';
recipient_address='\0';
}
Address(string sender_address, string recipient_address)
{
this->sender_address=sender_address;
this->recipient_address=recipient_address;
}
string getsender_address()
{
return sender_address;
}
void setsender_address(string sender_address)
{
this->sender_address=sender_address;
}
string getrecipient_address()
{
return recipient_address;
}
void setrecipient_address(string recipient_address)
{
this->recipient_address=recipient_address;
}
void showAddressDetails()
{
cout<<"\nSender Address: ";
cout<<this->sender_address;
cout<<"\nRecipient Address: ";
cout<<this->recipient_address<<endl;
}
};
// Customer class
class Customer: public Address
{
protected:
int trackID;
string name;
string contact_number;
public:
Customer()
{
trackID=0;
name='\0';
contact_number='\0';
}
Customer(int trackID, string name, string contact_number,string sa,string ra)
: Address(sa,ra)
{
this->trackID=trackID;
this->name=name;
this->contact_number=contact_number;
}
int gettrackID()
{
return trackID;
}
void settrackID(int trackID)
{
this->trackID=trackID;
}
string getname()
{
return name;
}
void setname(string name)
{
this->name=name;
}
string getcontact_number()
{
return contact_number;
}
void setcontact_number(string contact_number)
{
this->contact_number=contact_number;
}
void showCustomerDetails()
{
cout<<"CUSTOMER DETAILS\n\n";
showAddressDetails();
cout<<"Tracking ID: ";
cout<<this->trackID;
cout<<"\nName: "<<this->name;
cout<<"\nContact Number: "<<this->contact_number;
}
};
// Invoice class
class Invoice
{
protected:
int orderID;
public:
Invoice()
{
orderID=0;
}
Invoice(int orderID)
{
this->orderID=orderID;
}
int getorderID()
{
return orderID;
}
void setorderID(int orderID)
{
this->orderID=orderID;
}
void PrintInvoice()
{
cout<<"\nTracking ID: "<<this->orderID;
}
};
//OrderClass
class Order
{
protected:
string s;
Customer c;
Invoice i;
public:
Order()
{
s='\0';
}
void display_Order()
{
cout<<"----------------Order Details----------------\n\n";
cout<<s<<endl;
i.PrintInvoice();
c.showCustomerDetails();
}
};
class PostalWorker
{
protected:
string name;
int age;
public:
PostalWorker()
{
name = '\0';
age = 0;
}
void Display_PostalWorker()
{
cout<<"\nName: "<<name<<endl;
cout<<"Age: "<<age<<endl;
}
};
class Clerk : public PostalWorker
{
protected:
int clerk_id;
public:
Clerk()
{
clerk_id = 0;
}
void Display_Clerk()
{
Display_PostalWorker();
cout<<"Position: Clerk\n";
cout<<"Clerk ID: "<<clerk_id<<endl;
}
};
public:
AccountOfficer()
{
ao_id = 0;
}
void Display_AccountOfficer()
{
Display_PostalWorker();
cout<<"Position: Account-Officer\n";
cout<<"Account-Officer ID: "<<ao_id<<endl;
}
};
public:
Postman()
{
p_id = 0;
}
void Display_Postman()
{
Display_PostalWorker();
cout<<"Position: Postman\n";
cout<<"Postman ID: "<<p_id<<endl;
}
};
class Payment
{
protected:
int amount;
AccountOfficer ao;
public:
Payment()
{
amount = 0;
}
void DisplayPay()
{
ao.Display_AccountOfficer();
cout<<"Payment: "<<amount<<endl;
}
};
class PostOffice
{
protected:
int weight;
float price;
public:
PostOffice()
{
weight=0;
price=75; //keeping it to 75 because of the registration fee
}
PostOffice(int weight, int price)
{
this->weight=weight;
this->price=price;
}
void ParcelPrice()
{
cout<<"\nWhich service you want to use LMS or General";
cout<<"\nFor UMS press 1 and General 2";
int type;
cin>>type;
if(type==1)
{
int i;
cout<<"\nFor UMS Local press 1";
cout<<"\nFor UMS city to city press 2";
cin>>i;
if(i==1)
{
cout<<"\nMenu for UMS Local";
cout<<"\nEnter Weight: ";
cin>>weight;
if(weight<=250)
{
price = price + 51;
}
else if(weight<=500)
{
price = price + 64;
}
else if(weight>1000)
{
int w=weight%500;
price=64+w*26;
}
else
{
cout<<"\nInvalid Weight entered";
}
}
else if(i==2)
{
cout<<"\nMenu for UMS City to City";
cout<<"\nEnter Weight: ";
cin>>weight;
if(weight<=250)
{
price = price + 86;
}
else if(weight<=500)
{
price = price + 132;
}
else if(weight>1000)
{
int w=weight%500;
price=132+w*43;
}
}
}
else if(type==2)
{
cout<<"\nGeneral Menu";
cout<<"\nEnter Weight";
cin>>weight;
if(weight<=1)
{
price = price + 100;
}
else if(weight>1 && weight<3)
{
price = price + 175;
}
else if(weight>3 && weight<5)
{
price = price + 250;
}
else if(weight>5 && weight<10)
{
price = price + 375;
}
else if(weight>10 && weight<15)
{
price = price + 500;
}
else if(weight>15 && weight<20)
{
price = price + 625;
}
else if(weight>20 && weight<25)
{
price = price + 750;
}
else if(weight>25 && weight<30)
{
price = price + 875;
}
}
else
{
cout<<"\n Invalid option entered";
}
}
};
class Mail
{
protected:
int mail_id;
public:
Mail()
{
mail_id = 0;
}
Mail(int m_id)
{
mail_id = m_id;
}
void DisplayMail()
{
cout<<"Mail ID: "<<mail_id<<endl;
}
};
void DisplayBouncedMail()
{
DisplayMail();
cout<<type<<endl;
}
};
void DisplayReturnedMail()
{
DisplayMail();
cout<<type<<endl;
}
};
class MailServices
{
protected:
int weight;
Mail m;
public:
MailServises()
{
weight=0;
}
void DisplayMailServices()
{
m.DisplayMail();
cout<<"Weight: "<<weight<<endl;
}
};
public:
float price = 75;
void ums()
{
cout<<"\nFor UMS press 1 \n";
int type;
cout<<"Enter: ";
cin>>type;
if(type==1)
{
int i;
cout<<"\nFor UMS Local press 1";
cout<<"\nFor UMS city to city press 2\n";
cout<<"Enter: ";
cin>>i;
if(i==1)
{
cout<<"\nMenu for UMS Local";
if(weight<=250)
{
price = price + 51;
}
else if(weight<=500)
{
price = price + 64;
}
else if(weight>1000)
{
int w=weight%500;
price=64+w*26;
}
else
{
cout<<"\nInvalid Weight entered";
}
else if(i==2)
{
cout<<"\nMenu for UMS City to City";
if(weight<=250)
{
price = price + 86;
}
else if(weight<=500)
{
price = price + 132;
}
else if(weight>1000)
{
int w=weight%500;
price=132+w*43;
}
}
};
int type;
cout<<"Enter: ";
cin>>type;
if(type==2)
{
if(weight<=1)
{
price = price + 100;
}
else if(weight>1 && weight<3)
{
price = price + 175;
}
else if(weight>3 && weight<5)
{
price = price + 250;
}
else if(weight>5 && weight<10)
{
price = price + 375;
}
else if(weight>10 && weight<15)
{
price = price + 500;
}
else if(weight>15 && weight<20)
{
price = price + 625;
}
else if(weight>20 && weight<25)
{
price = price + 750;
}
else if(weight>25 && weight<30)
{
price = price + 875;
}
cout<<"Total Price: "<<price<<endl;
}
};
class GPO
{
protected:
string city_name;
int postal_code;
public:
GPO()
{
city_name='\0';
postal_code=0;
}
GPO(string city, int code)
{
city_name=city;
postal_code=code;
}
void showDetails()
{
cout<<"City Name: "<<city_name;
cout<<"Postal Code"<<postal_code;
}
};
int main()
{
int t_id;
string n;
string cn;
string sa;
string ra;
string name;
int age;
int weight;
int mailid;
int it;
int id;
int id2;
int q=1;
int nn=1;
int oo=1;
system("color 03");
system("cls");
cout<<"\n\n\n\n\n\t\t_______________________________________________________________
_____________________\n";
cout<<"\t\t| ===============>> WELCOME <<================
|\n";
cout<<"\t\t| TO
|\n";
cout<<"\t\t|
---------------------------------------------------------------------- |\n";
cout<<"\t\t| PAKISTAN POST OFFICE
|\n";
cout<<"\t\t|________________________________________________________________________
__________|\n";
cout<<"\t\t|
|\n";
cout<<"\t\t|
|\n";
cout<<"\t\t| MADE BY : SHAHMEER ALI MIRZA 19I-0860
|\n";
cout<<"\t\t|________________________________________________________________________
__________|\n\n\n\n\n\n\n";
system("pause");
while(q==1){
cout<<"\n\n\t\t\t======================================================\n\t\t" ;
cout<<"\n\n ==>> Enter your choice : " ;
cin>>choice;
switch ( choice )
{
case 'A':
while(nn==1)
{
system("cls"); //REGISTER CUSTOMERS
cout<<"\n\n\n\n\n\t\t_______________________________________________________________
_____________________\n";
cout<<"\t\t| REGISTER CUSTOMERS MENU
|\n";
cout<<"\t\t|________________________________________________________________________
__________|\n";
cout<<"\t\t| ==>> 1. ADD YOUR DATA"<<"
|\n";
cout<<"\t\t| ==>> 2. USE URGENT MAIL SERVICE "<<"
|\n";
cout<<"\t\t| ==>> 3. USE REGULAR MAIL SERVICE"<<"
|\n";
cout<<"\t\t| ==>> 4. MAIN MENU"<<"
|\n";
cout<<"\t\t| ==>> 5. EXIT"<<"
|\n";
cout<<"\t\t|________________________________________________________________________
__________|\n\n";
cout<<"\n\n ==>> Enter your choice : " ;
cin>>choice1;
switch(choice1)
{
case '1':
{
system("cls");
Customer c(t_id,n,cn,sa,ra);
system("cls");
c.showCustomerDetails();
system("pause");
break;
}
case '2':
{
system("cls");
Mail m(mailid);
UMS u(weight,m);
u.ums();
system("pause");
break;
case '3':
{
system("cls");
Mail m(mailid);
RMS r(weight,m);
r.rms();
system("pause");
break;
exit(1);
system("pause");
}
}
break;
}
case 'B':
{
while(oo==1)
{
system("cls"); //HEAD OF EMPLOYEE LOGIN
cout<<"\n\n\n\n\n\t\t_______________________________________________________________
_____________________\n";
cout<<"\t\t| HEAD OF EMPLOYEE MENU
|\n";
cout<<"\t\t|________________________________________________________________________
__________|\n";
cout<<"\t\t| ==>> 1. ADD DATA"<<"
|\n";
cout<<"\t\t| ==>> 2. DELETE DATA "<<"
|\n";
cout<<"\t\t| ==>> 3. MAIN MENU"<<"
|\n";
cout<<"\t\t| ==>> 4. EXIT"<<"
|\n";
cout<<"\t\t|________________________________________________________________________
__________|\n\n";
cout<<"\n\n ==>> Enter your choice : " ;
cin>>choice1;
switch(choice1)
{
case '1':
system("cls");
if(it==1)
{
system("cls");
cout<<"Enter Name: ";
cin>>name;
cout<<"Enter Age: ";
cin>>age;
cout<<"Enter ID: ";
cin>>id2;
AccountOfficer acco(name,age,id2);
system("cls");
acco.Display_AccountOfficer();
system("pause");
break;
else if(it==2)
{
system("cls");
cout<<"Enter Name: ";
cin>>name;
cout<<"Enter Age: ";
cin>>age;
cout<<"Enter ID: ";
cin>>id;
Clerk clerk(name,age,id);
else if(it==3)
{
system("cls");
cout<<"Enter Name: ";
cin>>name;
cout<<"Enter Age: ";
cin>>age;
cout<<"Enter ID: ";
cin>>id;
Postman post(name,age,id);
system("cls");
post.Display_Postman();
system("pause");
break;
case '2':
{
system("cls");
if(it==1)
{
system("cls");
cout<<"Enter ID: ";
cin>>id;
else if(it==3)
{ system("cls");
}
case '3': //Back to Main Men
system("cls");
oo=0;
break;
case '4': //Exit Program
exit(1);
system("pause");
}
}
break;
}
case 'C':
{
system("cls");
Invoice i(19442);
Customer cust(194,"Shahmeer Ali","033350302942","Islamabad","Karachi");
Order o("First Order",cust,i);
o.display_Order();
cout<<"\n\n";
system("pause");
break;
case 'D':
{
exit(1);
system("pause");
}