contoh program data Mahasiswa menggunakan Array pada Java Programing.
dengan cara menginputkan beberapa data mahasiswa yang di inputkan lebih dari 1
import java.io.*;
class Mahasiswa{
Mahasiswa(){
}
public void tampilMahasiswa() throws IOException{
int b,nim1,nim2,nim3,nim4,nim5,umur1,umur2,umur3,umur4,umur5;
String nama1,nama2,nama3,nama4,nama5,alamat1,alamat2,alamat3,alamat4,alamat5;
BufferedReader br = new BufferedReader
(new InputStreamReader(System.in));
System.out.println("========================================================");
System.out.print("Masukkan Nim :");
nim1=Integer.parseInt(br.readLine());
System.out.print("Masukkan Nama:");
nama1=br.readLine();
System.out.print("Masukkan Umur:");
umur1=Integer.parseInt(br.readLine());
System.out.print("Masukkan Alamat :");
alamat1=br.readLine();
System.out.println("========================================================");
System.out.print("Masukkan Nim :");
nim2=Integer.parseInt(br.readLine());
System.out.print("Masukkan Nama:");
nama2=br.readLine();
System.out.print("Masukkan Umur:");
umur2=Integer.parseInt(br.readLine());
System.out.print("Masukkan Alamat :");
alamat2=br.readLine();
System.out.println("========================================================");
System.out.print("Masukkan Nim :");
nim3=Integer.parseInt(br.readLine());
System.out.print("Masukkan Nama:");
nama3=br.readLine();
System.out.print("Masukkan Umur:");
umur3=Integer.parseInt(br.readLine());
System.out.print("Masukkan Alamat :");
alamat3=br.readLine();
System.out.println("========================================================");
System.out.print("Masukkan Nim :");
nim4=Integer.parseInt(br.readLine());
System.out.print("Masukkan Nama:");
nama4=br.readLine();
System.out.print("Masukkan Umur:");
umur4=Integer.parseInt(br.readLine());
System.out.print("Masukkan Alamat :");
alamat4=br.readLine();
System.out.println("========================================================");
System.out.print("Masukkan Nim :");
nim5=Integer.parseInt(br.readLine());
System.out.print("Masukkan Nama:");
nama5=br.readLine();
System.out.print("Masukkan Umur:");
umur5=Integer.parseInt(br.readLine());
System.out.print("Masukkan Alamat :");
alamat5=br.readLine();
System.out.println("========================================================");
String[]nama={nama1,nama2,nama3,nama4,nama5};
String[]alamat={alamat1,alamat2,alamat3,alamat4,alamat5};
int[]nim={nim1,nim2,nim3,nim4,nim5};
int[]umur={umur1,umur2,umur3,umur4,umur5};
System.out.print("Masukkan Nim yang ingin di cari =");
b=Integer.parseInt(br.readLine());
if (b==nim[0]){
System.out.print("Nim Nomor ");
System.out.println(nim[0]);
System.out.print("Dimiliki oleh ");
System.out.println(nama[0]);
System.out.print("Umur :");
System.out.println(umur[0]);
System.out.print("Alamat :");
System.out.println(alamat[0]);
}else if(b==nim[1]){
System.out.print("Nim Nomor ");
System.out.println(nim[1]);
System.out.print("Dimiliki oleh ");
System.out.println(nama[1]);
System.out.print("Umur :");
System.out.println(umur[1]);
System.out.print("Alamat :");
System.out.println(alamat[1]);
}else if(b==nim[2]){
System.out.print("Nim Nomor ");
System.out.println(nim[2]);
System.out.print("Dimiliki oleh ");
System.out.println(nama[2]);
System.out.print("Umur :");
System.out.println(umur[2]);
System.out.print("Alamat :");
System.out.println(alamat[2]);
}else if(b==nim[3]){
System.out.print("Nim Nomor ");
System.out.println(nim[3]);
System.out.print("Dimiliki oleh ");
System.out.println(nama[3]);
System.out.print("Umur :");
System.out.println(umur[3]);
System.out.print("Alamat :");
System.out.println(alamat[3]);
}else if(b==nim[4]){
System.out.print("Nim Nomor ");
System.out.println(nim[4]);
System.out.print("Dimiliki oleh ");
System.out.println(nama[4]);
System.out.print("Umur :");
System.out.println(umur[4]);
System.out.print("Alamat :");
System.out.println(alamat[4]);
}else
System.out.print("Nim Yang Anda Masukkan Tidak Terdaftar");
}
}
class DataMahasiswa{
public static void main(String args[])throws IOException{
BufferedReader br = new BufferedReader
(new InputStreamReader(System.in));
Mahasiswa stikom = new Mahasiswa();
stikom.tampilMahasiswa();
}
}
Dengan cara menginputkan nim = nomor induk mahasiswa untuk mencari data mahasiswa yang sudah di registrasi.
Materi Populer
-
contoh program data Mahasiswa menggunakan Array pada Java Programing. dengan cara menginputkan beberapa data mahasiswa yang di inputkan lebi...
-
Membuat tampilan GUI sederhana dengan Java import javax.swing.JOptionPane; class tingkat1 { public static void main(String[] args) { //memas...
-
import java.io.*; class Penilaian { public static void main(String[] args) throws IOException { BufferedReader bfr= new BufferedReade...
-
IGP Routing yang umum digunakan adalah RIP, OSPF dan BGP. RIP dan OSPF dikategorikan sebagai interior gateway routing protocol (IGP) sedan...
Kamis, 16 Desember 2010
Langganan:
Postingan (Atom)