Home > Back-end >  Output errors occur - 9.25596 e 061, don't know what was wrong
Output errors occur - 9.25596 e 061, don't know what was wrong

Time:05-24

HTML code is as follows, tested a issued a wage output have this problem
 # 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 () {P_salary=0; };
~ 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=a;
}
Public:
Void the print () {
Cout & lt; <"Employee categories: employees paid" & lt; Cout & lt; Cout & lt; <"Employee number:" & lt; Cout & lt; <"Wages," & lt; }
};
The class HourlyEmployee: public ployee {
Public:
HourlyEmployee () {};
~ HourlyEmployee () {};
HourlyEmployee (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;
}
Void salarysum (double a=45, double b=19, double c=0, double d=0, double e=0) {
If (b & lt;=40)
P_salary=a * b;
The else
P_salary=a * b + (b - 40) * a * 1.5;
}
Public:
Void the print () {
Cout & lt; <"Employee categories: hourly employees" & lt; Cout & lt; Cout & lt; <"Employee number:" & lt; Cout & lt; <"Wages," & lt; }
};
The class CommissionEmployee: public ployee {
Public:
CommissionEmployee () {};
~ CommissionEmployee () {};
CommissionEmployee (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;
}
Void salarysum (double a, b double, double c=12, double d=20, double e=0) {
P_salary +=c * d;
}
Public:
Void the print () {
Cout & lt; <"Employee categories: commission employees" & lt; Cout & lt; Cout & lt; <"Employee number:" & lt; Cout & lt; <"Wages," & lt; }
};
The class BasePlusCommissionEmployee: public ployee {
Public:
BasePlusCommissionEmployee () {};
~ BasePlusCommissionEmployee () {};
BasePlusCommissionEmployee (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;
}
Void salarysum (double a=400, double b=0, double c=20, double d=10, double e=0) {
P_salary +=e + c * d;
}
Public:
Int jud (int n);
Void the print () {
Cout & lt; <"Employee categories: take base salary commission employees" & 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.0;
}
Return p.P _salary;
}
Int main () {
String s;
Int id=0, mon=0, day=0, year=0, t=0;
Double a=0, b=0, c=0, d=0, e=0;
Char ch=0;
Cout & lt; <"Please enter the name of employees" & lt; cin> s;
Cout & lt; <"Please enter the employee number" & lt; cin> Id;
Cout & lt; <"Please enter the employee birthday" & lt; cin> Year & gt;> Mon & gt;> Day;
Cout & lt; <"Please select employees types: a. employees paid b. c. hourly employees commission employees d. take base salary commission employees" & lt; cin> Ch;
The switch (ch) {
Case 'A' : {SalariedEmployee p=SalariedEmployee (s, id);
Cout & lt; <"Please enter the employee weekly" & lt; cin> a; P. alarysum (a);
/* cout & lt; <"Please enter the current month" & lt; cin> t; */
P.p rint (); } break;
Case 'B' : {HourlyEmployee p=HourlyEmployee (s, id); } break;
Case 'C' : {CommissionEmployee p=CommissionEmployee (s, id); } break;
Case 'D' : {BasePlusCommissionEmployee p=BasePlusCommissionEmployee (s, id); } break;
}
Return 0



}

CodePudding user response:

Run your program, did not find abnormality:
nullnullnullnullnullnullnullnullnullnullnull
  • Related