Employee #name:string #salary:double +Employee (string, double) +getDetails ():void Developer Manager # progType : string # level int +Developer (string, double, string) +Manager(string, double, int)...


Based on UML diagram given in Figure 1 which implements the concept of inheritance and polymorphism. Complete the source code with appropriate command to get expected output shown in Figure 2.


P.S. It's Partly answered please correct if there a mistake and solve the empty fields


Employee<br>#name:string<br>#salary:double<br>+Employee (string, double)<br>+getDetails ():void<br>Developer<br>Manager<br># progType : string<br># level<br>int<br>+Developer (string, double, string)<br>+Manager(string, double, int)<br>+getDetails () :void<br>+getDetails ():void<br>Figure 1: UML diagram<br>Name: Alex , Salary: $5000, Level: 2<br>Name: John , Salary: $2000, Specialization: C++<br>Figure 2: Expected output<br>

Extracted text: Employee #name:string #salary:double +Employee (string, double) +getDetails ():void Developer Manager # progType : string # level int +Developer (string, double, string) +Manager(string, double, int) +getDetails () :void +getDetails ():void Figure 1: UML diagram Name: Alex , Salary: $5000, Level: 2 Name: John , Salary: $2000, Specialization: C++ Figure 2: Expected output
1.<br>#include <iostream><br>2.<br>using namespace std;<br>3.<br>class Employee<br>{<br>Protected<br>string name;<br>6.<br>double salary;<br>public:<br>8.<br>Employee(string name, double salary){<br>9.<br>this->name<br>=name;<br>10.<br>this->salary<br>=salary;<br>11.<br>}<br>12.<br>virtual void getDetails()<br>=03;<br>%3D<br>13.<br>14.<br>class Manager: public Employee<br>{<br>15.<br>int level;<br>16.<br>public:<br>Manager(string name, double salary,int level): Employee<br>(name,salary){<br>18.<br>this->level=level<br>19.<br>}<br>20.<br>void getDetails(){<br>21.<br>cout<<progType=progType 28. } 29. void getDetails(){ 30. cout<><><><><",specialization:><> 35. } 36. int main(0{ 37. Manager m("Alex",5000,2); 38. 39. Developer d("John",2000,"C++"); 40. 41. return 0; 42. } 4. 5. 7. 17. "/>
Extracted text: 1. #include 2. using namespace std; 3. class Employee { Protected string name; 6. double salary; public: 8. Employee(string name, double salary){ 9. this->name =name; 10. this->salary =salary; 11. } 12. virtual void getDetails() =03; %3D 13. 14. class Manager: public Employee { 15. int level; 16. public: Manager(string name, double salary,int level): Employee (name,salary){ 18. this->level=level 19. } 20. void getDetails(){ 21. cout<"><",><><><><«endl;} 22.="" };="" 23.="" class="" developer:="" public="" employee="" {="" 24.="" string="" progtype;="" 25.="" public:="" 26.="" developer(string="" name,double="" salary,string="" progtype):="" employee="" (name,salary){="" 27.="" this-="">progType=progType 28. } 29. void getDetails(){ 30. cout<><><><><",specialization:><> 35. } 36. int main(0{ 37. Manager m("Alex",5000,2); 38. 39. Developer d("John",2000,"C++"); 40. 41. return 0; 42. } 4. 5. 7. 17.
Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here