-
Notifications
You must be signed in to change notification settings - Fork 17
/
College Student Grade.cpp
170 lines (150 loc) · 7.28 KB
/
College Student Grade.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
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
#include<iostream>
#include<iomanip>
#include<string.h>
using namespace std;
int x, i;
float p, pp, n;
float a, b, c, d, e;
float k, t, ku, ut, ua;
char nama[50][50], nim[100][50], nilai[100];
float absen[100], tugas[100], kuis[100], uas[100], uts[100], akhir[100];
int wadaw(){
do{
cout << "<<<===PERSENTASE PENILAIAN===>>>\n";
cout << "================================\n";
cout << "Masukkan persentase kehadiran (%) : ";
cin >> k;
cout << "Masukkan persentase tugas (%) : ";
cin >> t;
cout << "Masukkan persentase kuis (%) : ";
cin >> ku;
cout << "Masukkan persentase UTS (%) : ";
cin >> ut;
cout << "Masukkan persentase UAS (%) : ";
cin >> ua;
pp = k + t + ku + ut + ua;
if(pp != 100){
cout << "Persentase penilaian (%) : " << pp << endl;
cout << "\n(***PERSENTASE PENILAIAN HARUS 100%***)\n";
cout << "---------------------------------------------------\n";}
if(pp == 100){
cout << "Persentase penilaian (%) : " << pp << endl;}}
while(pp != 100);
cout << "---------------------------------------------------\n";
cout << "Masukkan total pertemuan : ";
cin >> p;
cout << "Masukkan jumlah mahasiswa : ";
cin >> n;
cout << "---------------------------------------------------\n";
for(i = 1; i <= n; i++){
cout << "Nama : ";
fflush(stdin);
gets(nama[i]);
cout << "NIM : ";
cin >> nim[i];
cout << "Kehadiran : ";
cin >> absen[i];
cout << "Nilai tugas : ";
cin >> tugas[i];
cout << "Nilai kuis : ";
cin >> kuis[i];
cout << "Nilai UTS : ";
cin >> uts[i];
cout << "Nilai UAS : ";
cin >> uas[i];
cout << "---------------------------------------------------\n";
a = ((absen[i] / p) * (k / 100) * 100);
b = ((tugas[i]) * (t / 100));
c = ((kuis[i]) * (ku / 100));
d = ((uts[i]) * (ut / 100));
e = ((uas[i]) * (ua / 100));
akhir[i] = a + b + c + d + e;
}}
int main(){
cout << "|***PROGRAM MENGHITUNG NILAI AKHIR***|\n";
cout << "|====================================|\n";
cout << "|Pilih mata kuliah: |\n";
cout << "|1. Pembangunan Karakter |\n";
cout << "|2. Fisika |\n";
cout << "|====================================|\n";
cout << "Pilih mata kuliah: ";
cin >> x;
cout << "---------------------------------------------------\n";
switch(x){
case 1:
wadaw();
cout << "\n===================================================================================================================\n";
cout << "| PEMBANGUNAN KARAKTER |\n";
cout << "|=================================================================================================================|";
cout << "\n| (2 SKS) |";
cout << "\n|=================================================================================================================|\n";
cout << "|No.| Nama Mahasiswa | NIM | Kehadiran | Tugas | Kuis | UTS | UAS | Nilai Akhir | Grade |\n";
cout << "|===|======================================|=========|===========|=======|======|=====|=====|=============|=======|\n";
for(i = 1; i <= n; i++){
cout << setiosflags(ios::left) << "|" << setw(3) << i;
cout << setiosflags(ios::left) << "|" << setw(38) << nama[i];
cout << setiosflags(ios::left) << "|" << setw(9) << nim[i];
cout << setiosflags(ios::left) << "|" << setw(11) << absen[i];
cout << setiosflags(ios::left) << "|" << setw(7) << tugas[i];
cout << setiosflags(ios::left) << "|" << setw(6) << kuis[i];
cout << setiosflags(ios::left) << "|" << setw(5) << uts[i];
cout << setiosflags(ios::left) << "|" << setw(5) << uas[i];
cout << setiosflags(ios::left) << "|" << setw(13) << akhir[i];
if(akhir[i] <= 100 && akhir[i] >= 80){
cout << setiosflags(ios::left) << "|" << setw(7) << "A" << "|";}
else if(akhir[i] <= 79 && akhir[i] >= 60){
cout << setiosflags(ios::left) << "|" << setw(7) << "B+" << "|";}
else if(akhir[i] <=59 && akhir[i] >= 55){
cout << setiosflags(ios::left) << "|" << setw(7) << "B" << "|";}
else if(akhir[i] <= 54 && akhir[i] >= 50){
cout << setiosflags(ios::left) << "|" << setw(7) << "C+" << "|";}
else if(akhir[i] <= 49 && akhir[i] >= 45){
cout << setiosflags(ios::left) << "|" << setw(7) << "C" << "|";}
else if(akhir[i] <= 44 && akhir[i] >= 40){
cout << setiosflags(ios::left) << "|" << setw(7) << "D+" << "|";}
else if(akhir[i] <= 39 && akhir[i] >= 35){
cout << setiosflags(ios::left) << "|" << setw(7) << "D" << "|";}
else {cout << setiosflags(ios::left) << "|" << setw(7) << "E" << "|";}
cout << endl;}
cout << "===================================================================================================================\n";
break;
case 2:
wadaw();
cout << "\n===================================================================================================================\n";
cout << "| FISIKA |\n";
cout << "|=================================================================================================================|";
cout << "\n| (3 SKS) |";
cout << "\n|=================================================================================================================|\n";
cout << "|No.| Nama Mahasiswa | NIM | Kehadiran | Tugas | Kuis | UTS | UAS | Nilai Akhir | Grade |\n";
cout << "|===|======================================|=========|===========|=======|======|=====|=====|=============|=======|\n";
for(i = 1; i <= n; i++){
cout << setiosflags(ios::left) << "|" << setw(3) << i;
cout << setiosflags(ios::left) << "|" << setw(38) << nama[i];
cout << setiosflags(ios::left) << "|" << setw(9) << nim[i];
cout << setiosflags(ios::left) << "|" << setw(11) << absen[i];
cout << setiosflags(ios::left) << "|" << setw(7) << tugas[i];
cout << setiosflags(ios::left) << "|" << setw(6) << kuis[i];
cout << setiosflags(ios::left) << "|" << setw(5) << uts[i];
cout << setiosflags(ios::left) << "|" << setw(5) << uas[i];
cout << setiosflags(ios::left) << "|" << setw(13) << akhir[i];
if(akhir[i] <= 100 && akhir[i] >= 80){
cout << setiosflags(ios::left) << "|" << setw(7) << "A" << "|";}
else if(akhir[i] <= 79 && akhir[i] >= 60){
cout << setiosflags(ios::left) << "|" << setw(7) << "B+" << "|";}
else if(akhir[i] <=59 && akhir[i] >= 55){
cout << setiosflags(ios::left) << "|" << setw(7) << "B" << "|";}
else if(akhir[i] <= 54 && akhir[i] >= 50){
cout << setiosflags(ios::left) << "|" << setw(7) << "C+" << "|";}
else if(akhir[i] <= 49 && akhir[i] >= 45){
cout << setiosflags(ios::left) << "|" << setw(7) << "C" << "|";}
else if(akhir[i] <= 44 && akhir[i] >= 40){
cout << setiosflags(ios::left) << "|" << setw(7) << "D+" << "|";}
else if(akhir[i] <= 39 && akhir[i] >= 35){
cout << setiosflags(ios::left) << "|" << setw(7) << "D" << "|";}
else {cout << setiosflags(ios::left) << "|" << setw(7) << "E" << "|";}
cout << endl;}
cout << "===================================================================================================================\n";
break;
default: cout << "(***TIDAK ADA MATA KULIAH YANG DIPILIH***)";
}
}