Tugas PBO ke 3
======>>>>>Make Class Buffered
package javaapplication1;
public class Buffered {
String nip;
String nama;
String alamat;
String jenisKelamin;
String status;
public void setNip(String nip){
this.nip=nip;
}
public void setNama(String nama){ this.nama=nama;
}
public void setAlamat(String alamat){ this.alamat=alamat;
}
public void setJenisKelamin(String jenisKelamin){ this.jenisKelamin=jenisKelamin;
}
public void setStatus(String status){ this.status=status;
}
public String getNip(){ return nip;
}
public String getNama(){ return nama;
}
public String getAlamat(){ return alamat;
}
public String getJenisKelamin(){return jenisKelamin;
}
public String getStatus(){ return status;
}
======>>>>>Call atribut from class Buffered to class ambil
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication1;
/**
*
* @author anik
*/
import java.io.*;
public class ambil {
public static void main (String []args)throws Exception{
Buffered p = new Buffered();
BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
String str;
String st;
System.out.print("Masukkan nip ");
p.setNip(br.readLine());
System.out.print("Masukkan nama ");
p.setNama(br.readLine());
System.out.print("Masukkan alamat ");
p.setAlamat(br.readLine());
System.out.print("Masukkan jenis kelamin (L/P)");
str=br.readLine();
str=str.trim();
System.out.print("Masukkan Status (M/L)");
st=br.readLine();
st=st.trim();
System.out.println("=================");
System.out.println("NIP : "+p.getNip());
System.out.println("Nama : "+p.getNama());
System.out.println("Alamat : "+p.getAlamat());
System.out.print("Jenis Kelamin : ");
if (str.equals("P"))
System.out.println("Perempuan");
else if (str.equals("L"))
System.out.println("Laki laki ");
else
System.out.println("Masukkan M/L");
System.out.print("Status: ");
if (st.equals("M"))
System.out.println("Menikah ");
else if (str.equals("L"))
System.out.println("Lajang ");
else
System.out.println("Masukkan M/L");
}}
and the result from task like this
package javaapplication1;
public class Buffered {
String nip;
String nama;
String alamat;
String jenisKelamin;
String status;
public void setNip(String nip){
this.nip=nip;
}
public void setNama(String nama){ this.nama=nama;
}
public void setAlamat(String alamat){ this.alamat=alamat;
}
public void setJenisKelamin(String jenisKelamin){ this.jenisKelamin=jenisKelamin;
}
public void setStatus(String status){ this.status=status;
}
public String getNip(){ return nip;
}
public String getNama(){ return nama;
}
public String getAlamat(){ return alamat;
}
public String getJenisKelamin(){return jenisKelamin;
}
public String getStatus(){ return status;
}
======>>>>>Call atribut from class Buffered to class ambil
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication1;
/**
*
* @author anik
*/
import java.io.*;
public class ambil {
public static void main (String []args)throws Exception{
Buffered p = new Buffered();
BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
String str;
String st;
System.out.print("Masukkan nip ");
p.setNip(br.readLine());
System.out.print("Masukkan nama ");
p.setNama(br.readLine());
System.out.print("Masukkan alamat ");
p.setAlamat(br.readLine());
System.out.print("Masukkan jenis kelamin (L/P)");
str=br.readLine();
str=str.trim();
System.out.print("Masukkan Status (M/L)");
st=br.readLine();
st=st.trim();
System.out.println("=================");
System.out.println("NIP : "+p.getNip());
System.out.println("Nama : "+p.getNama());
System.out.println("Alamat : "+p.getAlamat());
System.out.print("Jenis Kelamin : ");
if (str.equals("P"))
System.out.println("Perempuan");
else if (str.equals("L"))
System.out.println("Laki laki ");
else
System.out.println("Masukkan M/L");
System.out.print("Status: ");
if (st.equals("M"))
System.out.println("Menikah ");
else if (str.equals("L"))
System.out.println("Lajang ");
else
System.out.println("Masukkan M/L");
}}
and the result from task like this
Comments
Post a Comment