Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ code i need help i wrote this code but i don't know how to write the class of Driver_Manager and i got this problem

c++ code i need help

image text in transcribedimage text in transcribedi wrote this code but i don't know how to write the class of Driver_Manager and i got this problem

#include

using namespace std;

class Person { private: string Name; string Email; string Gender; public: virtual void setName(string n){ Name = n;} virtual void setEmail(string n){ Email = n;} virtual void setGender(string n){ Gender = n;}

string getName(){ return Name;} string getEmail(){ return Email;} string getGender(){ return Gender;} };

class Customer : public Person{ private: string DeliveryAddress; public: virtual void setDeliveryAddress(string n){ DeliveryAddress = n;}

string getDeliveryAddress(){ return DeliveryAddress;} };

class Employee : public Person{ private: double Salary; public: virtual void setSalary(double n){ Salary = n;}

double getSalary(){ return Salary;} };

class Driver_Employee : public Employee{ private: int License; int NumberOfDeliveries; public: virtual void setLicense(int n){ License = n;}

int getLicense(){ return License;} virtual void setNumberOfDeliveries(int n){ NumberOfDeliveries = n;}

int getNumberOfDeliveries(){ return NumberOfDeliveries;} };

class Manager : public Employee{ private: double AnnualBonus; public: virtual void setAnnualBonus(double n){ AnnualBonus = n;}

double getAnnualBonus(){ return AnnualBonus;} };

class Driver_Manager : public Manager , public Driver_Employee{

// what should i write here };

int main() { Person pers1; pers1.setName("Kahlid"); pers1.setEmail("Khalid@kuwait.com"); pers1.setGender("Male"); cout

return 0; }

//also this problem i have

main.cpp: In function int main(): main.cpp:150:11: error: request for member setName is ambiguous 150 | dmgr1.setName("Fahad"); | ^~~~~~~ main.cpp:20:17: note: candidates are: virtual void Person::setName(std::string) 20 | virtual void setName(string n){ | ^~~~~~~ main.cpp:20:17: note: virtual void Person::setName(std::string) main.cpp:151:11: error: request for member setEmail is ambiguous 151 | dmgr1.setEmail("fahad@Q8Fashion.com"); | ^~~~~~~~ main.cpp:23:17: note: candidates are: virtual void Person::setEmail(std::string) 23 | virtual void setEmail(string n){ | ^~~~~~~~ main.cpp:23:17: note: virtual void Person::setEmail(std::string) main.cpp:152:11: error: request for member setGender is ambiguous 152 | dmgr1.setGender("Male"); | ^~~~~~~~~ main.cpp:26:18: note: candidates are: virtual void Person::setGender(std::string) 26 | virtual void setGender(string n){ | ^~~~~~~~~ main.cpp:26:18: note: virtual void Person::setGender(std::string) main.cpp:153:11: error: request for member setSalary is ambiguous 153 | dmgr1.setSalary(756.86); | ^~~~~~~~~ main.cpp:57:17: note: candidates are: virtual void Employee::setSalary(double) 57 | virtual void setSalary(double n){ | ^~~~~~~~~ main.cpp:57:17: note: virtual void Employee::setSalary(double) main.cpp:157:43: error: request for member getName is ambiguous 157 | cout   - You have been hired by Q8Fashion Co. to design and implement their IT system. - They told you that the system should record the information related to their Customers, and Employees. - Every Person in the system should contain the following basic information: Name, Email, and Gender. - For Customers, you should record the Name, Email, Gender, Delivery Address. - For Employees you should record the Name, Email, Gender, and Salary. - For Driver Employees you should record the Name, Email, Gender Salary, Driving License Number, and Number of Deliveries. - For Managers you should record the Name, Email, Gender, Salary, and Annual Bonus Amount. - You should note that there are Driver Managers who are Drivers and Managers at the same time. - Draw an inheritance Hierarchy (/0.5) - Code the Main Classes using the minimum number of Classes (Hint: use inheritance) (/0.75) - Generate Getters and Setters (/0.75)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions