import java.util.Scanner;
public class Person {
private int nomhs;
private String nama;
private String jurusan;
private int ipk;
public Person(int no, String n, String jur, int ip)
{
this.nomhs=no;
this.nama=n;
this.jurusan=jur;
this.ipk=ip;
}
public void info()
{
System.out.println("NIM = "+this.nomhs);
System.out.println("Nama = "+this.nama);
System.out.println("Jurusan = "+this.jurusan);
System.out.println("IPK = "+this.ipk);
}
public static void main(String [] args) {
Scanner masuk = new Scanner(System.in);
System.out.print("Masukkan NIM : ");
int nomhs = masuk.nextInt();
masuk.nextLine();
System.out.print("Masukkan Nama : ");
String nama = masuk.nextLine();
System.out.print("Masukkan Jurusan : ");
String jurusan = masuk.nextLine();
System.out.print("Masukkan IPK : ");
int ipk = masuk.nextInt();
Person oop = new Person(nomhs,nama,jurusan,ipk);
Person cos = new Person(nomhs,nama,jurusan,ipk);
oop.info();
}
}
Silahkan download filenya disini
Tidak ada komentar:
Posting Komentar