class tugas {
public static void main (String[] arg) throws IOException
{
int bnr,p;
double g;
String[] mapel;
mapel = new String[6];
//mengisi array element
mapel[0] = "Bahasa Indonesia, Soal = 50";
mapel[1] = "Bahasa Inggris, Soal = 50";
mapel[2] = "Matematika, Soal = 40";
mapel[3] = "Fisika, Soal = 40";
mapel[4] = "Kimia, Soal = 40";
mapel[5] = "Biologi, Soal = 40";
System.out.println("******TUGAS PRAKTIKUM BAHASA PEMROGRAMAN******");
System.out.println("**********************************************\n");
System.out.println("Rahmat Bintoro Ali Murtopo\t->\t10.01.53.0179");
System.out.println("Ahus Jalaludin\t\t\t\t->\t10.01.53.0175\n");
System.out.println("**********************************************");
System.out.println("**********************************************\n");
BufferedReader br;
br =new BufferedReader(new InputStreamReader(System.in));
System.out.println("*)Mata Pelajaran:");
System.out.println("1.Bahasa Indonesia");
System.out.println("2.Bahasa Inggris");
System.out.println("3.Matematika");
System.out.println("4.Fisika");
System.out.println("5.Kimia");
System.out.println("6.Biologi");
System.out.println("*)Masukkan Pilihan Anda:");
p =Integer.parseInt(br.readLine());
if(p==1)
{
System.out.println("*)Mata Pelajaran\t->\t" +mapel[0]);
System.out.println("*)Masukkan Jumlah Benarnya: ");
bnr =Integer.parseInt(br.readLine());
if(bnr<=50)
{
g =(bnr*100)/50;
System.out.println("Nilai:" +g);}
else{
System.out.println("Warning!!, Jangan masukkan Jumlah Benarnya Melebihi batas Soal");}}
else if(p==2)
{
System.out.println("*)Mata Pelajaran\t->\t" +mapel[1]);
System.out.println("*)Masukkan Jumlah Benarnya: ");
bnr =Integer.parseInt(br.readLine());
if(bnr<=50)
{
g =(bnr*100)/50;
System.out.println("Nilai:" +g);}
else{
System.out.println("Warning!!, Jangan masukkan Jumlah Benarnya Melebihi batas Soal");}}
else if(p==3)
{
System.out.println("*)Mata Pelajaran\t->\t" +mapel[2]);
System.out.println("*)Masukkan Jumlah Benarnya: ");
bnr =Integer.parseInt(br.readLine());
if(bnr<=40)
{
g =(bnr*100)/40;
System.out.println("Nilai:" +g);}
else{
System.out.println("Warning!!, Jangan masukkan Jumlah Benarnya Melebihi batas Soal");}}
else if(p==4)
{
System.out.println("*)Mata Pelajaran\t->\t" +mapel[3]);
System.out.println("*)Masukkan Jumlah Benarnya: ");
bnr =Integer.parseInt(br.readLine());
if(bnr<=40)
{
g =(bnr*100)/40;
System.out.println("Nilai:" +g);}
else{
System.out.println("Warning!!, Jangan masukkan Jumlah Benarnya Melebihi batas Soal");}}
else if(p==5)
{
System.out.println("*)Mata Pelajaran\t->\t" +mapel[4]);
System.out.println("*)Masukkan Jumlah Benarnya: ");
bnr =Integer.parseInt(br.readLine());
if(bnr<=40)
{
g =(bnr*100)/40;
System.out.println("Nilai:" +g);}
else{
System.out.println("Warning!!, Jangan masukkan Jumlah Benarnya Melebihi batas Soal");}}
else if(p==6)
{
System.out.println("*)Mata Pelajaran\t->\t" +mapel[5]);
System.out.println("*)Masukkan Jumlah Benarnya: ");
bnr =Integer.parseInt(br.readLine());
if(bnr<=40)
{
g =(bnr*100)/40;
System.out.println("Nilai:" +g);}
else{
System.out.println("Warning!!, Jangan masukkan Jumlah Benarnya Melebihi batas Soal");}}
else
{
System.out.println("Pilihan yang Anda masukkan salah");}
}
}
Output :