-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanager.cpp
101 lines (85 loc) · 1.95 KB
/
manager.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include "manager.h"
#include <iomanip>
extern QString expression_id, expression_name, expression_grade, expression_salary, expression;
double Manager::all = 0;
Manager::Manager() {
}
void Manager::set(QString newName, double newSalary) {
Person::newPerson();
id = Person::showPerson();
name = newName;
salary = newSalary;
all +=salary;
}
void Manager::show() {
expression_id += QString::number(id);
expression_id += "\n";
expression_grade += "Manager";
expression_grade += "\n";
expression_name += name;
expression_name += "\n";
expression_salary += QString::number(salary);
expression_salary += "\n";
}
QString Manager::getName() {
return name;
}
int Manager::getid() {
return id;
}
void Manager::write() {
int i;
expression += QString::number(id);
for(i = 1; i <= 20 - (QString::number(id)).length(); i++) {//设置输出格式
expression += " ";
}
expression += "Manager";
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 Manager::out() {//无格式输出
expression += QString::number(id);
expression += " ";
expression += "Manager";
expression += " ";
expression += name;
expression += " ";
expression += QString::number(salary);
expression += " ";
expression += "\n";
}
void Manager::change() {
id--;
}
void Manager::del() {
isdel = true;
all -= salary;
return;
}
bool Manager::getdel(){
return isdel;
}
/*void Manager::setname(QString a) {
name = a;
}*/
/*void Manager::operator+() {
all += salary;
return;
}
void Manager::operator-() {
all -= salary;
return;
}*/
double Manager::showall() {
return all;
}