Mahasiswa (Java Class)
public class Mahasiswa {
public String NPM;
public String Nama;
public String getNPM(){
System.out.println("NPM : "+NPM);
return NPM;
}
public void setNPM(String NPM){
this.NPM = NPM;
}
public String getNama(){
System.out.println("Nama : "+Nama);
return Nama;
}
public void setNama(String Nama){
this.Nama = Nama;
}
}
Main_Mahasiswa (Java Main Class)
import java.util.Scanner;
public class Main_Mahasiswa {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
String NPM, Nama;
Mahasiswa nadiya = new Mahasiswa();
System.out.print("Masukan Npm :");
NPM = input.nextLine();
System.out.print("Masukan Nama :");
Nama = input.nextLine();
nadiya.setNPM(NPM);
nadiya.getNPM();
nadiya.setNama(Nama);
nadiya.getNama();
}
}
Output Assignment 1
Mahasiswa (Java Class)
public class Mahasiswa1 {
public String NPM;
public String Nama;
public String Alamat;
public String No_Hp;
public String Email;
public String Instagram;
public String getNPM(){
System.out.println("NPM : "+NPM);
return NPM;
}
public void setNPM(String NPM){
this.NPM = NPM;
}
public String getNama(){
System.out.println("Nama : "+Nama);
return Nama;
}
public void setNama(String Nama){
this.Nama = Nama;
}
public String getAlamat(){
System.out.println("Alamat : "+Alamat);
return Alamat;
}
public void setAlamat(String Alamat){
this.Alamat = Alamat;
}
public String getNo_Hp(){
System.out.println("No_Hp : "+No_Hp);
return No_Hp;
}
public void setNo_Hp(String No_Hp){
this.No_Hp = No_Hp;
}
public String getEmail(){
System.out.println("Email : "+Email);
return Email;
}
public void setEmail(String Email){
this.Email = Email;
}
public String getInstagram(){
System.out.println("Instagram : "+Instagram);
return Instagram;
}
public void setInstagram(String Instagram){
this.Instagram = Instagram;
}
}
Main_Mahasiswa1 (Java Main Class)
import java.util.Scanner;
public class Main_Mahasiswa1 {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
String NPM, Nama, Alamat, No_Hp, Email, Instagram;
Mahasiswa1 nadiya = new Mahasiswa1();
System.out.print("Masukan Npm : ");
NPM = input.nextLine();
System.out.print("Masukan Nama : ");
Nama = input.nextLine();
System.out.print("Masukan Alamat : ");
Alamat = input.nextLine();
System.out.print("Masukan No HP : ");
No_Hp = input.nextLine();
System.out.print("Masukan Email : ");
Email = input.nextLine();
System.out.print("Masukan Instagram : ");
Instagram = input.nextLine();
nadiya.setNPM(NPM);
nadiya.getNPM();
nadiya.setNama(Nama);
nadiya.getNama();
nadiya.setAlamat(Alamat);
nadiya.getAlamat();
nadiya.setNo_Hp(No_Hp);
nadiya.getNo_Hp();
nadiya.setEmail(Email);
nadiya.getEmail();
nadiya.setInstagram(Instagram);
nadiya.getInstagram();
}
}
Output Assignment 2
§ Alamat web Program studi, Fakultas, Universitas : http://ti.ftik.teknokrat.ac.id, http://ftik.teknokrat.ac.id, www.teknokrat.ac.id
§ Nama Mahasiswa : NADIYA SAFITRI
§ NPM : 19316014
§ Kelas : Tk19B
Tidak ada komentar:
Posting Komentar