Nama : Natasa Kinski
Kelas : 2KB02
NPM : 24110924
JAVA
Membuat Koding Konversi
Output nya :
Koding Java :
public class konversi {
public static void main (String [] args){
natasya a = new natasya ();
a.NA = 82;
a.grade ();
natasya b = new natasya ();
b.NA = 24 ;
b.grade ();
hari c = new hari ();
c.NB= 5;
c.hari ();
}
}
class natasya {
int NA;
String NH;
void grade(){
if (NA>75)
NH = "A";
else if (NA > 50)
NH = "B";
else
NH ="D";
System.out.println ("Nilai Angka
"+NA);
System.out.println ("Nilai
Huruf"+NH);
}
}
class hari{
int NB;
String NC;
void hari (){
if (NB==1)
NC = "senin";
else if (NB==2)
NC = "selasa";
else if (NB==3)
NC ="rabu";
else if (NB==4)
NC ="ksmis";
else if (NB==5)
NC ="jum'at";
else if (NB==6)
NC ="sabtu";
else if (NB==7)
NC ="minggu";
System.out.println ("Nama Hari
"+NC);
}
}
Tidak ada komentar:
Posting Komentar