import java.util.Scanner;
class NilaiMahasiswa{
public static void main(String args[]){
Scanner baca = new Scanner(System.in);
String[] nama = new String[0];
double [] []nilai = new double[0] [0];
int pilih, jumlahData, i;
do{
System.out.println("Menu Pilihan:");
System.out.println("1. Menyimpan Data");
System.out.println("2. Menampilkan Data:");
System.out.println("0. Selesai:");
System.out.println("Menu dipilih:"); pilih= baca.nextInt();
System.out.println();
switch (pilih) {
case 1: System.out.println("Jumlah data:"); jumlahData= baca.nextInt();
nama= new String [jumlahData];
nilai= new double[jumlahData] [2];
i=0;
while(i<nama. length){
System.out.println("data ke-"+(i+1));
System.out.println("Nama:"); nama [i]= baca.nextLine();
nama[i]= baca.nextLine();
System.out.println("UTS:"); nilai [1] [0]= baca.nextDouble();
System.out.println("UAS:"); nilai [1] [1]= baca.nextDouble();
i++;
}
break;
case 2: System.out.println("Data yang tersimpan adalah:");
for (i=0;i<nama.length;i++){
System.out.println("Data ke-"+(i+i));
System.out.println("Nama :"+nama[i]);
System.out.println("UTS :"+nilai[i] [0]);
System.out.println("UAS :"+nilai[i] [1]);
System.out.println("Status :");
if ((nilai[i] [0]+nilai[i] [1])/2 >=55){
System.out.println("Lulus");
}else{
System.out.println("Tidak Lulus :");
}
}
break;
case 0: System.out.println("Terima Kasih :"); break;
default:System.out.println("Menu yang dipilih tidak terdaftar :");
}
}while (pilih != 0);
}
}
class NilaiMahasiswa{
public static void main(String args[]){
Scanner baca = new Scanner(System.in);
String[] nama = new String[0];
double [] []nilai = new double[0] [0];
int pilih, jumlahData, i;
do{
System.out.println("Menu Pilihan:");
System.out.println("1. Menyimpan Data");
System.out.println("2. Menampilkan Data:");
System.out.println("0. Selesai:");
System.out.println("Menu dipilih:"); pilih= baca.nextInt();
System.out.println();
switch (pilih) {
case 1: System.out.println("Jumlah data:"); jumlahData= baca.nextInt();
nama= new String [jumlahData];
nilai= new double[jumlahData] [2];
i=0;
while(i<nama. length){
System.out.println("data ke-"+(i+1));
System.out.println("Nama:"); nama [i]= baca.nextLine();
nama[i]= baca.nextLine();
System.out.println("UTS:"); nilai [1] [0]= baca.nextDouble();
System.out.println("UAS:"); nilai [1] [1]= baca.nextDouble();
i++;
}
break;
case 2: System.out.println("Data yang tersimpan adalah:");
for (i=0;i<nama.length;i++){
System.out.println("Data ke-"+(i+i));
System.out.println("Nama :"+nama[i]);
System.out.println("UTS :"+nilai[i] [0]);
System.out.println("UAS :"+nilai[i] [1]);
System.out.println("Status :");
if ((nilai[i] [0]+nilai[i] [1])/2 >=55){
System.out.println("Lulus");
}else{
System.out.println("Tidak Lulus :");
}
}
break;
case 0: System.out.println("Terima Kasih :"); break;
default:System.out.println("Menu yang dipilih tidak terdaftar :");
}
}while (pilih != 0);
}
}
Tidak ada komentar