forked from Rustam-Z/cpp-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudentCourseEvaluation.cpp
More file actions
184 lines (175 loc) · 3.16 KB
/
Copy pathstudentCourseEvaluation.cpp
File metadata and controls
184 lines (175 loc) · 3.16 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#include <iostream>
#include <string>
using namespace std;
// creating a class named "Student"
class Student
{
private:
string student_id;
string student_name;
double OOP2_Score;
double math_Score;
double english_Score;
double total_Score;
double ctotal()
{
total_Score = OOP2_Score + math_Score + english_Score;
return total_Score;
}
public:
void TakeData()
{
cout << "ID : ";
cin >> student_id;
cout << "Name: ";
cin >> student_name;
cout << "OOP2: ";
cin >> OOP2_Score;
cout << "Math: ";
cin >> math_Score;
cout << "English: ";
cin >> english_Score;
ctotal();
}
void showData()
{
cout << "ID: " << student_id << endl;
cout << "Name: " << student_name << endl;
cout << "OOP2: " << OOP2_Score << endl;
cout << "Math: " << math_Score << endl;
cout << "English: " << english_Score << endl;
cout << "Total score: " << total_Score << endl;
}
};
// creating a class named "Employee"
class Employee
{
private:
string Employee_ID;
string Employee_Name;
int Hours;
int Rate;
public:
void setEmployee_ID(string x)
{
Employee_ID = x;
}
string getEmployee_ID()
{
return Employee_ID;
}
void setEmployee_Name(string y)
{
Employee_Name = y;
}
string getEmployee_Name()
{
return Employee_Name;
}
void setHours(int z)
{
Hours = z;
}
int getHours()
{
return Hours;
}
void setRate(int i)
{
Rate = i;
}
int getRate()
{
return Rate;
}
double total_salary()
{
int total;
total = Hours * Rate;
return total;
}
};
int main()
{
int choice;
cout << "1. Student" << endl;
cout << "2. Employee" << endl;
cout << "Your choice: ";
cin >> choice;
cout << endl;
Student student; // creating an object of a class "Student"
Employee employee; // creating an object of a class "Employee"
switch (choice)
{
case 1:
{
student.TakeData();
cout << endl;
student.showData();
}
break;
case 2:
{
while (true)
{
system("cls");
int choice_employee;
cout << "1. Input Employee Details\n";
cout << "2. Display Employee Details\n";
cout << "3. Display Salary\n";
cin >> choice_employee;
switch (choice_employee)
{
case 1:
{
string x, y;
int z, i;
system("cls");
cout << "\t\t\tEmployee information\n";
cout << "Employee_ID: ";
cin >> x;
cout << "Employee_Name: ";
cin >> y;
cout << "Number of worked Hours: ";
cin >> z;
cout << "Rate per Hour: ";
cin >> i;
cout << endl;
employee.setEmployee_ID(x);
employee.setEmployee_Name(y);
employee.setHours(z);
employee.setRate(i);
system("pause");
}
break;
case 2:
{
system("cls");
cout << "ID: " << employee.getEmployee_ID() << endl;
cout << "Name: " << employee.getEmployee_Name() << endl;
cout << "Hours: " << employee.getHours() << endl;
cout << "Rate: " << employee.getRate() << endl;
system("pause");
}
break;
case 3:
{
system("cls");
cout << "Total salary: " << employee.total_salary() << endl;
system("pause");
}
break;
default:
cout << "Incorrect input! Try again!" << endl;
break;
}
}
}
break;
default:
cout << "Incorrect input! Try again!" << endl;
break;
}
system("pause");
return 0;
}