【Problem Description】
Define an employee class Employee with data members name and number. Define a salesperson that inherits from the employee class Sales, and the salary is 10% of the sales commission. Define a manager class with a fixed salary of 8,000. Define a sales manager class that inherits from the salesperson class and manager class. The salary is a fixed salary of 5,000 plus 5% commission on sales. Each class has a display() function to output information and write a main function test. Define a sales manager object in the main function with a sales volume of 100,000 and output information.
【Input form】
Input for program reference (the first line of prompt text):
Input id name and sale:
M001 zhangsan 100000
[Output form]
The output of the program reference is as follows:
ID:M001
Name: zhangsan
Salary:10000
#include <iostream>
using namespace std;
class Employee
{
public:
Employee(string id,string name):id(id),name(name){}
void display()
{
cout<<"ID:"<<id<<endl;
cout<<"Name:"<<name<<endl;
}
protected:
string id,name;
};
class Sales : virtual public Employee
{
public:
Sales(string id, string name, float sale): Employee(id,name)