Listing Program Java Data Nilai Mahasiswa dengan Array

import java.util.Scanner;

public class DataMahasiswacob{
public static void main(String[] args){

int row, kolom;
int tambah;
String[] [] data = new String[10][6];

Scanner input = new Scanner(System.in);

System.out.println("\nMasukkan Data Mahasiswa Maksimal 10 Mahasiswa");

for (row = 0; row < 10; row++){

System.out.println("\tTambah Data tekan 1 \t Print Data tekan 2 : ");
try {
tambah = input.nextInt();
}
catch (Exception e){
System.out.println("Ketik angka 1 atau 2 :");
break;
}

if (tambah == 1) {
System.out.println("\n Masukkan Data Tanpa spasi :");

System.out.print("Masukkan NIM :");
data[row][0] = input.next();
System.out.print("Masukkan Nama : ");
data[row][1] = input.next();
System.out.print("Masukkan UTS : ");
data[row][2] = input.next();
System.out.print("Masukkan UAS : ");
data[row][3] = input.next();
System.out.print("Masukkan NA : ");
data[row][4] = input.next();
System.out.print("Masukkan NH : ");
data[row][5] = input.next();
}
else{
if (tambah ==2){
System.out.println("\nNIM: Nama : UTS : UAS : NA : NH : ");
for (row = 0; row< 10; row++){
for(kolom = 0; kolom < 6; kolom++){
System.out.print(data [row][kolom] + " : ");
} System.out.println(" ");
}
break;
}
else
break;
}
}
}
}
Previous
Next Post »

1 comments:

Click here for comments
Anonim
admin
20 April 2012 pukul 09.25 ×

bang ini program java nya pake apa?

Congrats bro Anonim you got PERTAMAX...! hehehehe...
Reply
avatar