Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<math.h>
- #include<cstdlib>
- #include<string>
- using namespace std;
- class person
- {
- protected:
- int id;
- string name;
- int age;
- string gender;
- int cell;
- double salary;
- public:
- void set_fieldname();
- void get_fieldname();
- void in_id();
- int get_id()
- {
- return (id);
- }
- void in_name();
- string get_name()
- {
- return (name);
- }
- void in_age();
- int get_age()
- {
- return (age);
- }
- void in_gender();
- string get_gender()
- {
- return (gender);
- }
- void in_cell();
- int get_cell()
- {
- return (cell);
- }
- void in_firstname();
- int out_id();
- };
- class owners: public person
- {
- private:
- double share;
- int moneyinacc;
- int bankacc;
- public:
- void addowner();
- void set_ownerfield()
- {
- set_fieldname();
- cout<<"SHARE: ";
- while(!(cin>>share))
- {
- cout << "Please enter a number! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- }
- void get_ownerfield()
- {
- cout<<name<<"\t\t "<<id<<"\t\t"<<gender<<"\t\t"<<age<<"\t "<<share<<endl;
- }
- void in_share();
- int get_share();
- double in_moneyinaccount();
- double get_moneyinaccount();
- double in_bankaccount();
- double get_bankaccount();
- };
- class manager: public person
- {
- private:
- int salary;
- int bankacc;
- public:
- void addmanager();
- void set_managerfield()
- {
- set_fieldname();
- cout<<"salary=";
- while(!(cin>>salary))
- {
- cout << "Please enter a number! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- }
- void get_managerfield()
- {
- cout<<name<<"\t\t "<<id<<"\t\t"<<gender<<"\t\t"<<age<<"\t "<<salary<<endl;
- }
- void in_salary();
- double get_salary();
- double in_bankacc();
- double get_bankacc();
- };
- class salesman: public person
- {
- private:
- int salary;
- int bankacc;
- int joiningdate;
- string sellingtype;
- public:
- void addsalesman();
- void set_salesmanfield()
- {
- set_fieldname();
- cout<<"SALARY: ";
- while(!(cin>>salary))
- {
- cout << "Please enter a number! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"JOININGDATE: ";
- while(!(cin>>joiningdate))
- {
- cout << "Please enter a number! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- }
- void get_salesmanfield()
- {
- cout<<name<<"\t\t "<<id<<"\t\t"<<gender<<"\t\t"<<age<<"\t "<<salary<<"\t "<<joiningdate<<endl;
- }
- void in_salaryy();
- void in_bankac();
- void in_sellingtype();
- void get_sellingtype();
- void get_salaryy();
- void get_bankac();
- };
- class client: public person
- {
- private:
- string purchase;
- public:
- void addclient();
- void set_clientfield()
- {
- cout<<"Name=";
- while(!(cin>>name))
- {
- cout << "Please enter a string! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"Gender=";
- while(!(cin>>gender))
- {
- cout << "Please enter a string! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"Age=";
- while(!(cin>>age))
- {
- cout << "Please enter a number! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"ID=";
- while(!(cin>>id))
- {
- cout << "Please enter a number! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"product bought=";
- while(!(cin>>purchase))
- {
- cout << "Please enter a string! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- }
- void get_clientfield()
- {
- cout<<name<<"\t\t "<<id<<"\t\t"<<gender<<"\t\t"<<age<<"\t "<<purchase<<endl;
- }
- void in_purchase();
- void get_purchase();
- };
- class product
- {
- protected:
- int id;
- string name;
- double price;
- string brand;
- string origin;
- double vat;
- double discount;
- public:
- void addproduct();
- void in_id();
- void get_id();
- void in_name();
- void get_name();
- void in_brand();
- void get_brand();
- };
- class food: public product
- {
- private:
- double expdate;
- double quantity;
- public:
- void addfood();
- void set_foodfield()
- {
- cout<<"Name=";
- while(!(cin>>name))
- {
- cout << "Please enter a string! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"Brand=";
- while(!(cin>>brand))
- {
- cout << "Please enter a string! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"Origin=";
- while(!(cin>>origin))
- {
- cout << "Please enter a string! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"ID=";
- while(!(cin>>id))
- {
- cout << "Please enter a number! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"Price=";
- while(!(cin>>price))
- {
- cout << "Please enter a number! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- }
- void get_foodfield()
- {
- cout<<id<<"\t\t"<<name<<"\t\t"<<brand<<"\t\t"<<origin<<"\t\t"<<price<<endl;
- }
- void in_expdate();
- void get_expdate();
- void in_quantity();
- void get_quantity();
- };
- class electronics: public product
- {
- private:
- int warrenty;
- int quantity;
- public:
- void set_electronicfield() {
- cout<<"Name=";
- while(!(cin>>name))
- {
- cout << "Please enter a string! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"Brand=";
- while(!(cin>>brand))
- {
- cout << "Please enter a string! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"Origin=";
- while(!(cin>>origin))
- {
- cout << "Please enter a string! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"ID=";
- while(!(cin>>id))
- {
- cout << "Please enter a number! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"Price=";
- while(!(cin>>price))
- {
- cout << "Please enter a number! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"Warranty=";
- while(!(cin>>warrenty))
- {
- cout << "Please enter a number! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- }
- void get_electronicfield()
- {
- cout<< id<<" "<<name<<" "<<brand<<"\t "<<origin<<"\t"<<price<<"\t\t"<<warrenty<<endl;
- }
- void addelectronic();
- void get_warrenty();
- void in_warrenty();
- void get_quantity();
- void in_quantity();
- };
- class cosmetics: public product
- {
- private:
- double expdate;
- int quantity;
- public:
- void addcosmetic();
- void set_cosmeticfield()
- {
- cout<<"Name=";
- while(!(cin>>name))
- {
- cout << "Please enter a string! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"Brand=";
- while(!(cin>>brand))
- {
- cout << "Please enter a string! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"Origin=";
- while(!(cin>>origin))
- {
- cout << "Please enter a string! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"ID=";
- while(!(cin>>id))
- {
- cout << "Please enter a number! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"Price=";
- while(!(cin>>price))
- {
- cout << "Please enter a number! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"Quantity=";
- while(!(cin>>quantity))
- {
- cout << "Please enter a number! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- }
- void get_cosmeticfield()
- {
- cout<<" "<< id<<" "<<name<<" "<<brand<<"\t"<<origin<<"\t "<<price<<"\t\t"<<quantity<<endl;
- }
- void get_expdate();
- void in_expdate();
- void get_quantity();
- void in_quantity();
- };
- void:: owners::addowner()
- {
- int b;
- char redo;
- do{
- int n=0;
- n++;
- set_ownerfield();
- cout<<"\nOwner information has been added:"<<endl;
- cout<<"\n id Name gender age Share(%) \n";
- cout<<"\n---------- --------- -------- ------- --------\n"<<endl;
- for(int i=0;i<n;i++){
- get_ownerfield();
- }
- cout<<endl;
- cout<<"do you want to add another:"<<endl;
- cin>>redo;
- }
- while(redo=='y'||redo=='Y');
- }
- void::manager::addmanager()
- {
- char redo;
- do{
- int i=0;
- set_managerfield();
- cout<<"\nManager information has been added:"<<endl;
- cout<<"\n id Name gender age salary\n"<<endl;
- cout<<"\n---------- --------- -------- ------- ---------\n"<<endl;
- // cout<<e[i].get_fieldname()<<endl;
- get_managerfield();
- cout<<"do you want to add another"<<endl;
- cin>>redo;
- }
- while(redo=='y'||redo=='Y');
- }
- void::salesman::addsalesman()
- {
- char redo;
- do{
- int i=0;
- set_salesmanfield();
- cout<<"\nSalesman information has been added:"<<endl;
- cout<<"\n id Name gender age salary joining\n"<<endl;
- cout<<"\n---------- --------- -------- ------- --------- -----------\n"<<endl;
- get_salesmanfield();
- cout<<"do you want to add another"<<endl;
- cin>>redo;
- }
- while(redo=='y'||redo=='Y');
- }
- void::client::addclient()
- {
- char redo;
- do{
- int i=0;
- set_clientfield();
- cout<<"\nInformation has been added:"<<endl;
- cout<<"\n id Name gender age purchase \n"<<endl;
- cout<<" ---------- --------- -------- ------- -----------\n"<<endl;
- get_clientfield();
- cout<<"do you want to add another"<<endl;
- cin>>redo;
- }
- while(redo=='y'||redo=='Y');
- }
- void::food::addfood()
- {
- char redo;
- do{
- int i=0;
- set_foodfield();
- cout<<"\nInformation has been added:"<<endl;
- cout<<"\n id Name Brand Made in price \n"<<endl;
- cout<<" ---------- --------- --------- --------- -----------\n"<<endl;
- get_foodfield();
- cout<<"do you want to add another"<<endl;
- cin>>redo;
- }
- while(redo=='y'||redo=='Y');
- }
- void::electronics::addelectronic()
- {
- char redo;
- do{
- int i=0;
- set_electronicfield();
- cout<<"\nInformation has been added:"<<endl;
- cout<<"\nid Name Brand Made in price warranty\n"<<endl;
- cout<<"\n--- -------- ------- -------- ------- ---------\n"<<endl;
- get_electronicfield();
- cout<<"do you want to add another"<<endl;
- cin>>redo;
- }
- while(redo=='y'||redo=='Y');
- }
- void::cosmetics::addcosmetic()
- {
- char redo;
- do{
- int i=0;
- set_cosmeticfield();
- cout<<"\nInformation has been added:"<<endl;
- cout<<"\n id Name Brand Made in price quantity\n"<<endl;
- cout<<" ------- -------- ------- -------- -------- -----------\n"<<endl;
- get_cosmeticfield();
- cout<<"do you want to add another"<<endl;
- cin>>redo;
- }
- while(redo=='y'||redo=='Y');
- }
- void::person ::get_fieldname()
- {
- cout<<id<<"\t\t"<<name<<"\t\t"<<gender<<"\t\t"<<age<<"\t"<<endl;
- }
- int::person::out_id()
- {
- return(id);
- }
- void::owners::in_share()
- {
- cin>>share;
- }
- double::owners::in_moneyinaccount()
- {
- cin>>moneyinacc;
- }
- double::owners::in_bankaccount()
- {
- cin>>bankacc;
- }
- int::owners::get_share()
- {
- cout<<share<<endl;
- }
- double::owners::get_moneyinaccount()
- {
- cout<<moneyinacc<<endl;
- }
- double::owners::get_bankaccount()
- {
- cout<<bankacc<<endl;
- }
- void::manager::in_salary()
- {
- cin>>salary;
- }
- double::manager::in_bankacc()
- {
- cin>>bankacc;
- }
- double::manager::get_salary()
- {
- cout<<salary<<endl;
- }
- double::manager::get_bankacc()
- {
- cout<<bankacc<<endl;
- }
- void::salesman::in_salaryy()
- {
- cin>>salary;
- }
- void::salesman::in_bankac()
- {
- cin>>bankacc;
- }
- void::salesman::in_sellingtype()
- {
- cin>>sellingtype;
- }
- void::salesman::get_salaryy()
- {
- cout<<salary<<endl;
- }
- void::salesman::get_bankac()
- {
- cout<<bankacc<<endl;
- }
- void::salesman::get_sellingtype()
- {
- cout<<sellingtype<<endl;
- }
- void::client::in_purchase()
- {
- cin>>purchase;
- }
- void::client::get_purchase()
- {
- cout<<purchase<<endl;
- }
- void::product::in_id()
- {
- cin>>id;
- }
- void::product::in_name()
- {
- cin>>name;
- }
- void::product::in_brand()
- {
- cin>>brand;
- }
- void::product::get_id()
- {
- cout<<id<<endl;
- }
- void::product::get_name()
- {
- cout<<name<<endl;
- }
- void::product::get_brand()
- {
- cout<<brand<<endl;
- }
- void::food::in_expdate()
- {
- cin>>expdate;
- }
- void::food::get_expdate()
- {
- cout<<expdate;
- }
- void::food::in_quantity()
- {
- cin>>quantity;
- }
- void::food::get_quantity()
- {
- cout<<quantity<<endl;
- }
- void::electronics::in_warrenty()
- {
- cin>>warrenty;
- }
- void::electronics::get_warrenty()
- {
- cout<<warrenty;
- }
- void::electronics::in_quantity()
- {
- cin>>quantity;
- }
- void::electronics::get_quantity()
- {
- cout<<quantity;
- }
- void::cosmetics::in_expdate()
- {
- cin>>expdate;
- }
- void::cosmetics::get_expdate()
- {
- cout<<expdate<<endl;
- }
- void::cosmetics::in_quantity()
- {
- cin>>quantity;
- }
- void::cosmetics::get_quantity()
- {
- cout<<quantity<<endl;
- }
- void::person::set_fieldname()
- {
- cout<<"Name=";
- while(!(cin>>name))
- {
- cout << "Please enter a string! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"Gender=";
- while(!(cin>>gender))
- {
- cout << "Please enter a string! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"Age=";
- while(!(cin>>age))
- {
- cout << "Please enter a number! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- cout<<"ID=";
- while(!(cin>>id))
- {
- cout << "Please enter a number! Try again: ";
- cin.clear ();
- cin.ignore (1000, '\n');
- }
- }
- int main()
- {
- owners objowner[5];
- manager objmanager;
- salesman objsalesman;
- client objclient;
- food objfood;
- electronics objelectronic;
- cosmetics objcosmetic;
- int add_owner_count=0;
- int c;
- char operation,ch;
- do
- {
- cout<<"who do you want to know about?\n"<<endl;
- cout<<endl;
- cout<<endl;
- cout<<" 1. About Owner"<<endl;
- cout<<" 2. About Manager"<<endl;
- cout<<" 3. About Salesman"<<endl;
- cout<<" 4. About Client"<<endl;
- cout<<" 5. About product"<<endl;
- cout<<endl;
- cout<<"Enter the Serial number you desire: ";
- cin>>c;
- if(c==1)
- {
- int x;
- char redo;
- do{
- int o;
- cout<<"\nOwner information"<<endl;
- cout<<endl;
- cout<<"1.Add owner"<<endl;
- cout<<"2.Delete owner"<<endl;
- cout<<"3.Search Owner"<<endl;
- cout<<endl;
- cout<<"enter choice: ";
- cin>>o;
- if(o==1)
- {
- cout<<"Enter the information of the owner:"<<endl;
- for(int i=add_owner_count;i<5;i++)
- {
- objowner[i].addowner();
- break;
- }
- }
- else if(o==2)
- {
- cout<<"enter info you want to search"<<endl;
- }
- else if(o==3)
- {
- cout<<"enter info you want to delete"<<endl;
- }
- cout<<"do you want to continue"<<endl;
- cin>>redo;
- }
- while(redo=='y'||redo=='Y');
- }
- else if(c==2)
- {
- char redo;
- do{
- int m;
- cout<<"\nManager information"<<endl;
- cout<<endl;
- cout<<"1.Add manager"<<endl;
- cout<<"2.Delete manager"<<endl;
- cout<<"3.Search Owner"<<endl;
- cout<<endl;
- cout<<"enter choice: "<<endl;
- cin>>m;
- if(m==1)
- {
- cout<<"enter manager information"<<endl;
- objmanager.addmanager();
- }
- else if(m==2)
- {
- cout<<"enter info you want to delete"<<endl;
- }
- else if(m==3)
- {
- cout<<"enter info you want to search"<<endl;
- }
- cout<<"do you want to continue"<<endl;
- cin>>redo;
- }
- while(redo=='y'||redo=='Y');
- }
- else if(c==3)
- {
- char redo;
- do{
- cout<<"\nSalesman Information"<<endl;
- int s;
- cout<<endl;
- cout<<"1.ADD Salesman"<<endl;
- cout<<"2.Delete Salesman"<<endl;
- cout<<"3.Search Salesman"<<endl;
- cout<<endl;
- cout<<"enter choice: "<<endl;
- cin>>s;
- if(s==1)
- {
- cout<<"add salesman information"<<endl;
- objsalesman.addsalesman();
- }
- else if(s==2)
- {
- cout<<"delete salesman information"<<endl;
- }
- else if(s==3)
- {
- cout<<"search salesman information"<<endl;
- }
- cout<<"do you want to continue"<<endl;
- cin>>redo;
- }
- while(redo=='y'||redo=='Y');
- }
- else if(c==4)
- {
- char redo;
- do{
- int x;
- cout<<"\nClient information"<<endl;
- cout<<endl;
- cout<<"1.Add client"<<endl;
- cout<<"2.Delete client"<<endl;
- cout<<"3.Search client "<<endl;
- cout<<endl;
- cout<<"enter choice: "<<endl;
- cin>>x;
- if(x==1)
- {
- cout<<"Add client information"<<endl;
- objclient.addclient();
- }
- else if(x==2)
- {
- cout<<"Delete information of client"<<endl;
- }
- else if(x==3)
- {
- cout<<"Search information of client"<<endl;
- }
- cout<<"do you want to continue"<<endl;
- cin>>redo;
- }
- while(redo=='y'||redo=='Y');
- }
- else if(c==5)
- {
- char redo;
- do{
- int p;
- cout<<"\nProduct information"<<endl;
- cout<<endl;
- cout<<"1.about food"<<endl;
- cout<<"2.about electronics"<<endl;
- cout<<"3.about cosmetics"<<endl;
- cout<<endl;
- cout<<"enter choice: "<<endl;
- cin>>p;
- if(p==1)
- {
- char redo;
- int x;
- cout<<"\nFood information"<<endl;
- cout<<"1.Add food"<<endl;
- cout<<"Enter choice:"<<endl;
- cin>>x;
- if(x==1)
- {
- cout<<"Add food information"<<endl;
- objfood.addfood();
- }
- }
- else if(p==2)
- {
- int x;
- cout<<"\nElectronic information"<<endl;
- cout<<"1.Add electronics"<<endl;
- cout<<"Enter your choice"<<endl;
- cin>>x;
- if(x==1)
- {
- cout<<"Electronics information"<<endl;
- objelectronic.addelectronic();
- }
- }
- else if(p==3)
- {
- int x;
- cout<<"\nCosmetics information"<<endl;
- cout<<"1.Add cosmetics"<<endl;
- cout<<"Enter choice"<<endl;
- cin>>x;
- if(x==1)
- {
- cout<<"cosmetic information"<<endl;
- objcosmetic.addcosmetic();
- }
- }
- cout<<"do you want to go to product menu"<<endl;
- cin>>redo;
- }
- while(redo=='y'||redo=='Y');
- }
- cout<<"do you want to go to main menu"<<endl;
- cin>>ch;
- }
- while(ch=='y'||ch=='Y');
- ;return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement