Home > Back-end >  Problems related to the class
Problems related to the class

Time:05-20

The HTML code is as follows, don't know why the salary output is the code; By the way, could you turn to a wave of how the compiler code interface screenshots, I won't question screenshot
# include
# include
# include
using namespace std;
The class Date {
Public:
Int year;
Int mon;
Int day;
};
The class ployee {
Public:
String P_name;
Int P_id;
The Date P_birthdate;
Double P_salary;
Public:
Ployee () {};
~ ployee () {};
Ployee (string p, int a) {
This - & gt; P_name=p;
This - & gt; P_id=a;
}
Public:
Virtual void salarysum (double a, b double, double c, double d and double e)=0.//a for water or hours weekly salary, b for the working hours, c for sales, d for sales commission, e for base salary
Public:
Virtual void print ()=0;
};
The class SalariedEmployee: public ployee {
Public:
SalariedEmployee (c string p, int, int a=2021, int b=01, int e=01) {
P_name=p;
P_id=c;
This - & gt; P_birthdate. Year=a;
This - & gt; P_birthdate. Mon=b;
This - & gt; P_birthdate. Day=e;
}
SalariedEmployee () {};
~ SalariedEmployee () {};
Void salarysum (double a=0, double b=0, double c=0, double d=0, double e=0) {
P_salary=P_salary + a;
}
Public:
Void the print () {
Cout & lt; <"Employee categories: employees paid" & lt; Cout & lt; Cout & lt; <"Employee number:" & lt; Cout & lt; <"Wages," & lt; }
};
Int jud (ployee& P, int n) {
If (p.P _birthdate. Mon==n) {
P.P _salary +=100;
}
Return p.P _salary;
}
Int main () {
String s;
Int id=0, mon=0, day=0, year=0, t=0;
Cout & lt; <"Please enter the name of employees" & lt; Cin & gt;> s;
Cout & lt; <"Please enter the employee number" & lt; Cin & gt;> Id;
Cout & lt; <"Please enter the employee birthday" & lt; Cin & gt; & gt; Year & gt;> Mon & gt;> Day;
SalariedEmployee p=SalariedEmployee (s, id);
Cout & lt; <"Please enter the employee weekly" & lt; Cin & gt;> a; P. alarysum (a);
Cout & lt; <"Please enter the current month" & lt; Cin & gt;> t;
P.p rint ();
return 0;
}
  • Related