TUGAS METOPEL

GambarGambarGambarGambarGambarGambarGambarGambarGambarGambar

Iklan

UTS PBO

cooding jawaban soal UTS no 2 anak2 teknik n manajemen sore

#include <iostream.h>
#include <conio.h>
#include <string.h>

class mahasiswa
{
private:
char npm[12], nama[25];
int t,uts,uas;

public:
void inisialisasi (char *NPMMHS, char *NAMAMHS, int T,int UTS,int UAS)
{
strcpy (npm, NPMMHS);
strcpy (nama, NAMAMHS);
t = T;
uts=UTS;
uas=UAS ;

}

void tampilkan()
{
cout <<“INPUT NILAI MAHASISWA : “<<endl;
cout <<“++++++++++++++++++: “<<endl;
cout <<“NPM : “;cin>>npm;
cout <<” Nama :”;cin>>nama;
cout <<” Nilai Tugas :”;cin>>t;
cout <<” Nilai UTS :”;cin>>uts;
cout <<” Nilai UAS :”;cin>>uas;
cout<<“”<<endl<<endl;
cout<<“NPM “<<npm<<endl;
cout<<“Nama”<<nama<<endl;
cout<<“Nilai Tugas :”<<t<<endl;
cout<<“Nilai UTS :”<<uts<<endl;
cout<<“Nilai UAS :”<<uas<<endl;
int total;
total=(((0.5*uas)+(0.3*uts)+(0.2*t)));
cout<<“total NIlai :”<<total<<endl;
// char indeks,ket;
//cout<<“indeks :”<<indeks;
// cout<<“keterangan:”<<ket;
if (total>=85 && total<=100)
{cout<<“indeks : A”<<endl;
cout<<“keterangan: Amat Baik”<<endl;}

else if (total>=75 && total<=84)
{cout<<“indeks : B”<<endl;
cout<<“keterangan: Baik”<<endl;}

else if (total>=65 && total<=74)
{cout<<“indeks : C”<<endl;
cout<<“keterangan: Cukup”<<endl;}

else if (total>=55 && total<=64)
{cout<<“indeks : D”<<endl;
cout<<“keterangan: kurang”<<endl;}

else if (total<=54 )
{cout<<“indeks : E”<<endl;
cout<<“keterangan: Gagal”<<endl;}

 

}
};

void main()
{
mahasiswa mhsd3;
// mhsd3.inisialisasi ();
mhsd3.tampilkan();

getch();
}Gambar