Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

 

Assignment No. 03
Semester: Spring 2021

CS304- Object Oriented Programming 

 

Total Marks: 20

 

Due Date: 26/07/2021

Lecture Covered: 23 - 29

Assignment File

Spring%202021_CS304_3.docx

Views: 229

Replies to This Discussion

cs304 assignment 3 solution chaiye plzz

In'Sha'Allah kal tk mil jae gi solution file.

cs304 ka solution chaiye??

Please Solution File Share Kr den..
#include
#include
#include
using namespace std;
class Employee{
public:
string name;
int age;
void setname(string name){ this->name=name;}
void setage(int age){ this->age=age;}
string geter(){ return name;}
double calculatesalary();
void print();
};
class salariedEmployee:public Employee
{
public:
double weeklysalary;
double calculateSalary(){ return weeklysalary;}
void print()
{
cout"Displaying Employee's Information"endl;
cout"----------------------------------------"endl;
cout"Employee Name :"nameendl;
cout"Employee age :"ageendl;
cout"Employee Salary :"weeklysalaryendl;
}
};
class hourEmp:public Employee
{
public:
double hours;
double wage;
double salary;
double calculateSalary()
{
if(hours<=40){ salary=wage*hours; }
else{ salary = (40*wage) +((hours-40)*wage*1.5); }
return salary;
}
void print()
{
cout"\n""Dsplaying Employee's Information"endl;
cout"----------------------------------------"endl;
cout"Employee Name: "nameendl;
cout"Employee age: "ageendl;
cout"Employee Salary: "salaryendl;
}
};
int main()
{
int iterate,x=0,y=0;
system("Color 0A");
cout"How many Emplyees data you want to enter?"endl;
cin>>iterate;
salariedEmployee sE[iterate];
hourEmp hE[iterate];
char choice;
for(int i=0;i
{
cout"Enter choice:S for SalariedEmployee , H for hourlyEmp: "endl;
cin>>choice;
if(choice=='S' || choice=='s')
{
cout"Enter name:";
cin>>sE[x].name;
cin.ignore();
cout"Enter age:";
cin>>sE[x].age;
cout"Enter salary:";
cin>>sE[x].weeklysalary;
x++;
}
else if(choice=='H' || choice=='h')
{
cout"Enter name:";
cin>>hE[y].name;
cout"Enter age:";
cin>>hE[y].age;
cout"Enter hours:";
cin>>hE[y].hours;
cout"Enter wage:";
cin>>hE[y].wage;
y++;
}
}
for(int i=0;i
{
sE[i].calculateSalary();
sE[i].print();
}
for(int i=0;i
{
hE[i].calculateSalary();
hE[i].print();
}
return 0;
}

RSS

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service