-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsalesman.cpp
87 lines (74 loc) · 1.77 KB
/
salesman.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include "salesman.h"
extern QString expression_id, expression_name, expression_grade, expression_salary, expression;
double Salesman::all = 0;
Salesman::Salesman() {
}
void Salesman::set(QString newName, double newMoney, double newPercentage)
{
Person::newPerson();
id = Person::showPerson();
name = newName;
salary = newMoney * newPercentage / 100;
all += salary;
}
void Salesman::show() {
expression_id += QString::number(id);
expression_id += "\n";
expression_grade += "Salesman";
expression_grade += "\n";
expression_name += name;
expression_name += "\n";
expression_salary += QString::number(salary);
expression_salary += "\n";
}
QString Salesman::getName() {
return name;
}
int Salesman::getid() {
return id;
}
void Salesman::write() {
int i;
expression += QString::number(id);
for(i = 1; i <= 20 - (QString::number(id)).length(); i++) {
expression += " ";
}
expression += "Salesman";
for(i = 1; i <= 20 - 7; i++) {
expression += " ";
}
expression += name;
for(i = 1; i <= 20 - name.length(); i++) {
expression += " ";
}
expression += QString::number(salary);
for(i = 1; i <= 20 - (QString::number(salary)).length(); i++) {
expression += " ";
}
expression += "\n";
}
void Salesman::out() {
expression += QString::number(id);
expression += " ";
expression += "Manager";
expression += " ";
expression += name;
expression += " ";
expression += QString::number(salary);
expression += " ";
expression += "\n";
}
void Salesman::change() {
id--;
}
void Salesman::del() {
isdel = true;
all -= salary;
return;
}
bool Salesman::getdel() {
return isdel;
}
double Salesman::showall() {
return all;
}