Contoh Coding Input Data Mahasiswa Java




Silahkan running di Netbeans atau Eclipse :


package DasarJava;

//ProgramInputDataMhsSatrioDwiPrabowo
import java.io.*;
public class InputDariKeyboard1{
public static void main(String[] args){
String NIM="", nama="";
byte nilAbsen=0, nilTugas=0, nilUTS=0, nilUAS=0;
  BufferedReader XSSDP = new BufferedReader(new InputStreamReader(System.in));
  try{
 System.out.println("====================================================================");
 System.out.println("\t Input Data Mahasiswa Telkom PDC Karawang       ");
 System.out.println("====================================================================");
 System.out.println("NIM\t\t:  ");   NIM=XSSDP.readLine();
 System.out.println("Nama\t\t:  ");   nama=XSSDP.readLine();
 System.out.println("Nilai Absen\t:  ");  nilAbsen=Byte.parseByte(XSSDP.readLine());
 System.out.println("Nilai Tugas\t:  ");  nilTugas=Byte.parseByte(XSSDP.readLine());
 System.out.println("Nilai UTS\t:  ");  nilUTS=Byte.parseByte(XSSDP.readLine());
 System.out.println("Nilai UAS\t:  ");  nilUAS=Byte.parseByte(XSSDP.readLine());
 System.out.println("====================================================================\n\n");
  }
catch(Exception e){
 System.out.println("Error : "+e);
}
  System.out.println("====================================================================");
System.out.println("\tCetak Data Mahasiswa Telkom PDC    ");     System.out.println("====================================================================");
System.out.println("NIM\t\t: "+NIM);     System.out.println("nama\t\t: "+nama);     System.out.println("Nilai Absen\t: "+nilAbsen);     System.out.println("Nilai Tugas\t: "+nilTugas);     System.out.println("Nilai UTS\t: "+nilUTS);     System.out.println("Nilai UAS\t: "+nilUAS);      }
}

NB : Class name nya samain ya :p
Comments
0 Comments