forked from Imran-Younas/OOP-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoopProject.cpp
More file actions
239 lines (194 loc) · 5.43 KB
/
Copy pathoopProject.cpp
File metadata and controls
239 lines (194 loc) · 5.43 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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#include <iostream>
using namespace std;
class MainActivity{
public:
MainActivity(){ //Constructor
cout<<">>>> UNIVERSITIES AGGREGATES CALCULATIONS <<<<"<<endl;
cout<<endl;
cout<<"chose below options :"<<endl;
cout<<"press 1 FAST NU"<<endl;
cout<<"press 2 NUST"<<endl;
cout<<"press 3 GIKI"<<endl;
cout<<"press 4 ETEA Medical "<<endl;
cout<<"press 5 Engineering"<<endl;
cout<<"Enter your choice : ";
}
~MainActivity(){
//Destructors
}
};
class inputMarks{ //Base Class
protected:
int obtained_Matric , total_Matric , obatined_Fsc, total_Fsc;
double matric_Percenatge , fsc_percentage;
public:
void matricPercentage(){
cout<<"Enter obtained marks of Matric : ";
cin>>obtained_Matric;
cout<<"Enter Total marks of Matric : ";
cin>>total_Matric;
/// Exceptional Handling
try{
if(total_Matric>0){
matric_Percenatge = ((obtained_Matric * 100) / total_Matric) ;
}
else
{
throw(total_Matric);
}
}
catch(int marks){
cout<<"warning : You Entered wrong marks : "<<marks<<endl;
}
}
///////////////////////// Zara Presentation
public:
void FscPercentage(){
cout<<"Enter obtained marks of Fsc : ";
cin>>obatined_Fsc;
cout<<"Enter Total marks of Fsc : ";
cin>>total_Fsc;
/// Exceptional Handling
try{
if(total_Fsc>0){
fsc_percentage =((obatined_Fsc * 100) / total_Fsc);
}
else
{
throw(total_Fsc);
}
}
catch(int marks){
cout<<"warning : You Entered wrong marks : "<<marks<<endl;
}
}
///////////////////
public:
virtual void agg(){
cout<<"Function for Overriding"<<endl;
}
};
class FAST : public inputMarks{ //Dervied Classes start from here
protected:
double fastAgg;
public:
void agg(){ // Function Overriding
fastAgg = ((matric_Percenatge * 50) / 100 ) + ((fsc_percentage * 50) / 100);
cout<<">>>> Your FAST NU Aggregate : "<<fastAgg<<endl;
cout<<"Aggregate according to COVID-19 policy"<<endl;
}
};
class NUST : public inputMarks{
protected:
int NET;
double nustAgg, NETpercentage;
public:
void agg(){ //Function Overriding
cout<<"Enter Your NET marks : ";
cin>>NET;
NETpercentage = ((NET * 100) / 200);
nustAgg = ((matric_Percenatge * 10)/100) + ((fsc_percentage * 15)/100) + ((NETpercentage * 75)/100);
cout<<">>>> Your NUST Aggregate : "<<nustAgg<<endl;
}
};
class GIKI : public inputMarks{
protected:
int gikiTest;
double GIKIAgg, GIKITestPercentage;
public:
void agg(){ //Function Overriding
cout<<"Enter Your GIKI Test marks : ";
cin>>gikiTest;
GIKITestPercentage = ((gikiTest * 100) / 200);
GIKIAgg = ((matric_Percenatge * 5)/100) + ((fsc_percentage * 10)/100) + ((GIKITestPercentage * 85)/100);
cout<<">>>> Your GIKI Aggregate : "<<GIKIAgg<<endl;
}
};
class EMedical : public inputMarks{
protected:
int ETEATest;
double EMAgg, ETestPercentage;
public:
void agg(){ //Function Overriding
cout<<"Enter Your ETEA Medical Test marks : ";
cin>>ETEATest;
ETestPercentage = ((ETEATest * 100) / 200);
EMAgg = ((fsc_percentage * 50)/100) + ((ETestPercentage * 50)/100);
cout<<">>>> Your ETEA Medical Aggregate : "<<EMAgg<<endl;
}
};
class EEngineering : public inputMarks{
protected:
int EngrTest;
double EngrAgg, EngrTesTPercentage;
public:
void agg(){ //Function Overriding
cout<<"Enter Your ETEA Engineering Test marks : ";
cin>>EngrTest;
EngrTesTPercentage = ((EngrTest * 100) / 800);
EngrAgg = ((matric_Percenatge * 10)/100) + ((fsc_percentage * 40)/100) + ((EngrTesTPercentage * 50)/100);
cout<<">>>> Your ETEA ENGINEERING Aggregate : "<<EngrAgg<<endl;
}
};
int main(){ //call All functions
int option;
FAST F;
NUST N;
GIKI G;
EMedical M;
EEngineering E;
char chose;
int i=0;
do{
MainActivity();
cin>>option;
//////////// FAST /////////
if (option == 1){
cout<<"---- FAST NU Aggregate Calculation -----"<<endl;
cout<<endl;
F.matricPercentage();
F.FscPercentage();
F.agg();
}
//////////// NUST /////////
else if (option == 2){
cout<<"---- NUST Aggregate Calculation -----"<<endl;
cout<<endl;
N.matricPercentage();
N.FscPercentage();
N.agg();
}
/////////////// GIKI ////////
else if (option == 3){
cout<<"---- GIKI Aggregate Calculation -----"<<endl;
cout<<endl;
G.matricPercentage();
G.FscPercentage();
G.agg();
}
//////////////// ETea Medical //////////
else if (option == 4){
cout<<"---- ETEA MEDICAL Aggregate Calculation -----"<<endl;
cout<<endl;
M.FscPercentage();
M.agg();
}
////////// ETEA ENGINEERING /////////
else if (option == 5){
cout<<"---- ETEA ENGINEERING Aggregate Calculation -----"<<endl;
cout<<endl;
E.matricPercentage();
E.FscPercentage();
E.agg();
}
else {
cout<<"**** Wrong INPUT. Please select a right choice ****"<<endl;
}
cout << "----------------------------" << endl;
cout << "for Continoue press 'Y' and for Exit press 'E'" << endl;
cout << endl;
cin >> chose;
i++;
}
while(chose=='y' || chose=='Y');
}