tugas pbo temen

Posted on Updated on

hai hai hai … jumpa lagi, masih di blog ini🙂

kli ini ane mo nge-share jawaban tugas temen yang minta dibikin aplikasi input data mahasiswa baru sederhana, langsung saja yah ^^

berikut nih tulisan kodenya :

import java.io.*;

public class test
{
public static void main(String[] args)
{
//deklarasi inisialisasi

String nim[] = new String[11];        //NIM
String nama[] = new String[11];        //NAMA MAHASISWA
String nfak[] = new String[11];        //NAMA FAKULTAS
int smtrst[] =new int[11];        //BIAYA SEMESTER I
int kfak[] = new int[11];        //KODE FAKULTAS
int gel[] = new int[11];        //GELOMBANG
int udaf[] = new int[11];        //UANG PENDAFTARAN
int tb[] = new int[11];            //TOTAL BIAYA PENDAFTARAN TANPA DISCOUNT
int diskon[] = new int[11];        //DISCOUNT
int total[] = new int[11];        //TOTAL YANG HARUS DIBAYAR SETELAH DISCOUNT
int i;                    //VARIABLE I

BufferedReader me=new BufferedReader(new InputStreamReader(System.in));
try
{
//input
for(i=1;i<=10;i++)
{
System.out.println (“|========================================================|”);
System.out.println (“| \t \t Form Input Mahasiswa Baru \t \t |”);
System.out.println (“| \t      Pemrograman Berorientasi Object \t \t |”);
System.out.println (“|========================================================|”);
System.out.println (“> Data ke : ” +i);
System.out.print (“> Masukkan NIM \t \t \t \t : “);
nim[i]=me.readLine();
System.out.print (“> Masukkan Nama \t \t \t : “);
nama[i]=me.readLine();
System.out.print (“> Masukkan Kode Fakultas \t \t : “);
kfak[i]=Integer.parseInt(me.readLine());
System.out.print (“> Masukkan Gelombang Pendaftaran  \t : “);
gel[i]=Integer.parseInt(me.readLine());
System.out.print (“> Masukkan Uang Pendaftaran \t \t : “);
udaf[i]=Integer.parseInt(me.readLine());
System.out.println (“|========================================================|”);
}

//output
for(i=1;i<=10;i++)
{
System.out.println (“|========================================================|”);
System.out.println (“| \t \t Data Mahasiswa Baru \t \t\t |”);
System.out.println (“| \t      Pemrograman Berorientasi Object \t \t |”);
System.out.println (“|========================================================|”);

System.out.println (“Data ke = “+i);
System.out.println (“Nim \t \t \t \t = ” +nim[i]);
System.out.println (“Nama \t \t \t \t = ” +nama[i]);
System.out.println (“Kode Fakultas \t \t \t = ” +kfak[i]);

if(kfak[i]==1)
{nfak[i]=”Fakultas Teknologi Informasi”;
} else if(kfak[i]==2)
{nfak[i]=”Fakultas Ilmu Komunikasi”;
} else if(kfak[i]==3)
{nfak[i]=”Fakultas Ekonomi”;
} else if(kfak[i]==4)
{nfak[i]=”FISIP”;
} else if(kfak[i]==5)
{nfak[i]=”Fakultas Teknik”;
} else if(kfak[i]==6)
{nfak[i]=”ASTRI”;
} else if(kfak[i]==7)
{nfak[i]=”FTI D3 Unggulan”;
} else {nfak[i]=”Belum ada Nama Fakultas untuk kode tersebut”;}
System.out.println (“Nama Fakultas \t \t \t = “+nfak[i]);

if(kfak[i]==1)
{smtrst[i]=12000000;
}else if(kfak[i]==2)
{smtrst[i]=12000000;
}else if(kfak[i]==3)
{smtrst[i]=11000000;
}else if(kfak[i]==4)
{smtrst[i]=9000000;
}else if(kfak[i]==5)
{smtrst[i]=8500000;
}else if(kfak[i]==6)
{smtrst[i]=8000000;
}else if(kfak[i]==7)
{smtrst[i]=7000000;
}else {smtrst[i]=0;}
System.out.println (“Biaya Semester I \t \t = ” +smtrst[i]);

tb[i] = udaf[i] + smtrst[i];
System.out.println (“Total Biaya \t \t \t = ” +tb[i]);

if(tb[i]>=10000000)
{diskon[i] = 5 * tb[i] / 100;
System.out.println (“Diskon \t \t \t \t = ” +diskon[i]);
} else if(tb[i]<10000000)
{diskon[i] = 0;
System.out.println (“Diskon \t \t \t \t = ” +diskon[i]);}

total[i] = tb[i] – diskon[i];
System.out.println (“Total yang harus dibayar \t = ” +total[i]);

System.out.println (“|========================================================|”);
}
}
catch (Exception x)
{
System.out.println (“error : ” +x);
}
}
}

nah begitu tuh kodenya, sangat sederhana sekali kan🙂 soalnya klo kebagusan takut disuruh live ngoding di depan kelas #katanya heee

demikian berbaginya, tungguin postingan berikut yah🙂

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s