Advertisement
JonathanA007

Jonathan Arya Priguna/Tugas 5 Soal 1

Oct 5th, 2023
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.11 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     double nilai_kuis, nilai_UAS, nilai_tugas, nilai_akhir,bobot;
  6.     char nilai_huruf;
  7.  
  8.     cout << "Masukkan nilai kuis: ";
  9.     cin >> nilai_kuis;
  10.     cout << "Masukkan nilai UAS: ";
  11.     cin >> nilai_UAS;
  12.     cout << "Masukkan nilai tugas: ";
  13.     cin >> nilai_tugas;
  14.  
  15.      if (nilai_UAS>=nilai_kuis){
  16.         nilai_akhir = 0.3 * nilai_kuis + 0.5 * nilai_UAS + 0.2 * nilai_tugas;
  17.     }
  18.     else {
  19.         nilai_akhir = 0.4 * nilai_kuis + 0.4 * nilai_UAS + 0.2 * nilai_tugas;
  20.     }
  21.  
  22.    
  23.     if (nilai_akhir >= 85) {
  24.         nilai_huruf = 'A';
  25.         bobot=4;
  26.     } else if (nilai_akhir >= 75) {
  27.         nilai_huruf = 'B';
  28.         bobot=3;
  29.     } else if (nilai_akhir >= 65) {
  30.         nilai_huruf = 'C';
  31.         bobot=2;
  32.     } else if (nilai_akhir >= 50) {
  33.         nilai_huruf = 'D';
  34.         bobot=1;
  35.     } else {
  36.         nilai_huruf = 'E';
  37.         bobot=0;
  38.     }
  39.  
  40.  
  41.    
  42.     cout << "Nilai akhir: " << nilai_akhir << endl;
  43.     cout << "Nilai huruf: " << nilai_huruf << endl;
  44.     cout << "Bobot: " << bobot << endl;
  45.  
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement