IN C++:
a) Implement a class Employee with the following members:
Private members:
int baseHours = 40;
double baseSalary = 40000.0;
int baseVacationDays = 10;
string baseVacationForm = "yellow";
public members:
int getHours();
double getSalary();
int getVacationDays();
string getVacationForm();
void setBaseHours(int hours);
void setBaseSalary(double salary);
void setBaseVacationDays(int days);
void setBaseVacationForm(string form);
b) Write the class Marketer that inherits Employee. Marketers make $50,000 ($10,000 more than general employees) and have an additional method called advertise that prints "Act now, while supplies last!" Make sure to interact with the Employee superclass as appropriate.
c) Write a class Janitor. Janitors work twice as many hours per week as other employees (80 hours/week), they make $30,000 ($10,000 less than general employees), they get half as much vacation as other employees (only 5 days), and they have an additional method clean that prints "Workin' for the man." Make sure to interact with the superclass as appropriate.
d) Write a class Lawyer that extends Employee. Lawyers vacation from is pink. Lawyers have a method sue() that prints “I’ll see you in court!”. Lawyers have 5 extra vacation days more than general employees.
e) Write a class HarvardLawyer. Harvard lawyers are like normal lawyers, but they make 20% more money than a normal lawyer, they get 3 days more vacation, and they have to fill out four of the lawyer's forms to go on vacation. That is, the getVacationForm method should return "pinkpinkpinkpink". Make sure to interact with the superclass as appropriate.
// Please refer to the screenshot of the code to understand
indentation in the code.
// Feel free to ask any doubts by commenting on the answer.
#include <iostream>
using namespace std;
class Employee
{
private:
// int baseHours = 40;
// double baseSalary =
40000.0;
// int baseVacationDays = 10;
// string baseVacationForm =
"yellow";
int baseHours;
double baseSalary;
int baseVacationDays;
string baseVacationForm;
public:
Employee()
{
baseHours =
40;
baseSalary =
40000.0;
baseVacationDays
= 10;
baseVacationForm
= "yellow";
}
int getHours()
{
return
baseHours;
}
double getSalary()
{
return
baseSalary;
}
int getVacationDays()
{
return
baseVacationDays;
}
string getVacationForm()
{
return
baseVacationForm;
}
void setBaseHours(int hours)
{
baseHours =
hours;
}
void setBaseSalary(double
salary)
{
baseSalary =
salary;
}
void setBaseVacationDays(int
days)
{
baseVacationDays
= days;
}
void setBaseVacationForm(string
form)
{
baseVacationForm
= form;
}
};
class Marketer : public Employee{
public:
Marketer()
{
setBaseSalary(50000.0);
}
void advertise()
{
cout<<"Act
now, while supplies last!"<<endl;
}
};
class Janitor : public Employee{
public:
Janitor()
{
setBaseHours(80);
setBaseSalary(30000.0);
setBaseVacationDays(5);
}
void clean()
{
cout<<"Workin' for the man."<<endl;
}
};
class Lawyer : public Employee{
public:
Lawyer()
{
setBaseVacationForm("pink");
setBaseVacationDays(15);
}
void sue()
{
cout<<"I'll see you in court!"<<endl;
}
};
class HarvardLawyer : public Lawyer{
public:
HarvardLawyer()
{
setBaseVacationDays(18);
setBaseSalary(48000);
setBaseVacationForm("pinkpinkpinkpink");
}
};
int main()
{
Marketer obj;
cout<<obj.getSalary()<<"
"<<obj.getVacationForm()<<endl;
obj.advertise();
Janitor obj1;
cout<<obj1.getHours()<<"
"<<obj1.getSalary()<<"
"<<obj1.getVacationDays()<<endl;
obj1.clean();
Lawyer obj2;
cout<<obj2.getVacationForm()<<"
"<<obj2.getVacationDays()<<endl;
obj2.sue();
HarvardLawyer obj3;
cout<<obj3.getVacationForm()<<"
"<<obj3.getVacationDays()<<"
"<<obj3.getSalary()<<endl;
obj3.sue();
}




IN C++: a) Implement a class Employee with the following members: Private members: int baseHours =...