Recent Videos


body{cursor: url(http://www.123cursors.com/freecursors/13567.ani); }
Got My Cursor @ 123Cursors.com
/">Got My Cursor @ 123Cursors.com
"),default}

Kamis, 27 Oktober 2011

Program Bilangan Ganjil dan Hari

dibawah ini coding lengkapnya :


package aa;
public class aa {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
konversi_main aa = new konversi_main();
aa.nilai = 90;                          
aa.grade ();                              
konversi_main aa = new konversi_main();
aa.nilai = 80;                        
aa.grade ();                              
hari y = new hari ();
y.angka=3;
y.grade();
}
}
class konversi_main {
int nilai;
String huruf;
void grade(){
if (nilai>75)
huruf = “A”;
else if (nilai>50)
huruf = “B”;
else if (nilai>25)
huruf = “C”;
else
huruf = “D”;
System.out.println(“Nilai angka : “+nilai);
System.out.println(“Nilai huruf : “+huruf);
}
}
class hari {
int angka;
String hr;
void grade(){
if (angka==1)
hr = “Senin”;
else if (angka==2)
hr = “Selasa”;
else if (angka==3)
hr = “Rabu”;
else if (angka==4)
hr = “Kamis”;
else if (angka==5)
hr = “Jumat”;
else if (angka==6)
hr = “Sabtu”;
else
hr = “Minggu”;
System.out.println(“Nilai angka : “+angka);
System.out.println(“Nilai hr : “+hr);
}
}
hasil

0 komentar:

Posting Komentar

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Powered by Blogger