








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









#include
void getdata(){ Publication::getdata(); cout<<"Enter playtime: ";cin>>time; } void putdata(){ Publication::putdata(); cout<<"Playtime: "<<time<<endl<<endl; } }; //Main Function int main(){ Book b1; Tape t1; t1.getdata(); b1.getdata(); t1.putdata(); b1.putdata(); }
#include
public: void getdata(){ cout<<"Enter Sales of last 3 months: "; cin>>record[0]>>record[1]>>record[2]; } Void putdata(){ cout<<"First Month Sales: "<<record[0]<<endl; cout<<"Second Month Sales: "<<record[1]<<endl; cout<<"Third Month Sales: "<<record[2]<<endl<<endl; } }; //Publication Class class Publication{ protected: string title; float price; public: Publication(string x="NULL",float y=0){ title=x; price=y; } void getdata(){ cout<<"Enter title: ";cin>>title; cout<<"Enter price: ";cin>>price; }
//Tape Class class Tape: public Publication,public Sales{ private: float time; public: Tape(string x="NULL",float y=0,float z=0): Publication(x,y){ time=z; } void getdata(){ Publication::getdata(); cout<<"Enter playtime: ";cin>>time; Sales::setdata(); } void putdata(){ Publication::putdata(); cout<<"Playtime: "<<time<<endl; Sales::putdata(); } }; //Main Function int main(){ Book b1; Tape t1; t1.getdata(); b1.getdata(); b1.putdata();
t1.putdata(); }
#include
Employee::get_data(); cout<<"Enter Shift: ";cin>>shift; cout<<"Enter Hourly Rate: ";cin>>rate; } float Calculate_salary(){ int hours;float salary; cout<<"\nEnter Hour Employee Worked: ";cin>>hours; if(shift==1){ salary=ratehours; return salary; } else if(shift==2){ salary=(rate+rate/2)hours; return salary; } } void display(){ int salary=Calculate_salary(); cout<<"Salary: "<<salary<<endl<<endl; }}; //Main Function int main(){ ProductionWorker person[5]; for(int i=0;i<5;i++){
person[i].set_data(); } for(int i=0;i<5;i++){ person[i].display(); } }
#include
annualSalary=z; } float Net_salary(){ int salary; return salary=annualSalary+bonus; } void Production_Goals(){ int goals; cout<<"Enter No. of goals: "; cin>>goals; if(goals>=15){ bonus=annualSalary((annualSalary/100)15); } else if(goals>=30){ bonus=annualSalary((annualSalary/100)30); } else{ bonus=0; } } }; //Main Function int main(){ ShiftSupervisor person1("Nabeel",12,2000); ShiftSupervisor person2("Adeel",13,3000),person3("Aqeel",14,4000);
ShiftSupervisor person4("Saad",15,5000),person5("Hassan",16,60000); //Bonus Calculation person1.Production_Goals(); person2.Production_Goals(); person3.Production_Goals(); person4.Production_Goals(); person5.Production_Goals(); //Displaying all data cout<<"Salary of person 1: "<<person1.Net_salary()<<endl; cout<<"Salary of person 2: "<<person2.Net_salary()<<endl; cout<<"Salary of person 3: "<<person3.Net_salary()<<endl; cout<<"Salary of person 4: "<<person4.Net_salary()<<endl; cout<<"Salary of person 5: "<<person5.Net_salary()<<endl; }