aku buat 3 class, semuanya ku tulis disini.. Nani kalo bikin ya pisah2in sendiri..
masa ga bisa..
package modul8;
public class Main {
public static void main(String[] args) {
Member [] m = new Member [4];
m [0] = new Member ("Kimberly", "10203040", "Perumahan Asri dekat ITS",
"Bungee Jumping", 110000, 45000, 5);
m [1] = new Member ("Billy", "13579", "-", "Jalan Aries", 250000, 0, 0);
m [2] = new Member ("Billy", "13579", "-", "Jalan Aries", 40000, 0, 0);
m [3] = new Member ("Kimberly", "10203040", "Perumahan Asri dekat ITS",
"Bungee Jumping", 60000, 35000, 5);
Umum u = new Umum ("Jason", "123456", "-", "-", 95000);
System.out.println("----------Transaksi "+u.getNama()+"----------"+
"\nJumlah yang Harus Dibayar : "+u.getHarga()+"\n");
System.out.println("-------Transaksi Member "+m[0].getNama()+"-------"+
"\nBesar Transaksi : "+m[0].getHarga()+
"\nAnda mengunakan Voucher senilai : "+m[0].getDiskonPoin(10)+
"\nJumlah yang Harus Dibayar : "+(m[0].getHarga()-m[0].getDiskonPoin(10))+"\n");
System.out.println("berterimakasihlah pada rhiezall");
System.out.println("-------Transaksi Member "+m[1].getNama()+"-------"+
"\nBesar Transaksi : "+m[1].getHarga()+
"\nJumlah yang Harus Dibayar : "+m[1].getBayar()+
"\nPoin Anda Bertambah Besar : "+m[1].getPoinTambah()+
"\nPoin Anda Sekarang : "+m[1].getPoinSkrg()+"\n");
System.out.println("-------Transaksi Member "+m[2].getNama()+"-------"+
"\nBesar Transaksi : "+m[2].getHarga()+
"\nAnda Menggunakan Voucher Senilai : "+m[2].getDiskonPoin(40)+
"\nJumlah yang Harus Dibayar : "+(m[2].getHarga()-m[2].getDiskonPoin(40))+"\n");
System.out.println("-------Transaksi Member "+m[3].getNama()+"-------"+
"\nBesar Transaksi : "+m[3].getHarga()+
"\nJumlah yang Harus Dibayar : "+m[3].getBayar()+
"\nPoin Anda Bertambah Besar : "+m[3].getPoinTambah()+
"\nPoin Anda Sekarang : "+m[3].getPoinSkrg()+"\n");
System.out.println("\nINFORMASI PELANGGAN" +
"\nNama : "+u.getNama()+
"\nNo.Hp : "+u.getHp()+
"\nAlamat : "+u.getAlamat()+
"\nHobi : "+u.getHobi());
for(int i=0;i<=1;i++){
System.out.println("\n=======Member=======" +
"\nNama : "+m[i].getNama()+
"\nNo.Hp : "+m[i].getHp()+
"\nAlamat : "+m[i].getAlamat()+
"\nHobi : "+m[i].getHobi());
}
}
}
package modul8;
public class Umum {
private final String nama;
private String hp;
private String alamat;
private String hobi;
int harga;
public Umum (String nama,String hp,String alamat,String hobi,int harga){
this.nama=nama;
this.hp=hp;
this.alamat=alamat;
this.hobi=hobi;
this.harga=harga;
}
public String getNama(){
return nama;
}
public String getHp(){
return hp;
}
public String getAlamat(){
return alamat;
}
public String getHobi(){
return hobi;
}
public int getHarga (){
return harga;
}
}
package modul8;
public class Member extends Umum {
private final int diskon = 10;
private int voucher;
private int poin;
// private int harga;
// private int bayar;
public Member (String nama, String hp, String alamat, String hobi,
int harga, int voucher, int poin){
super(nama,hp,alamat,hobi,harga);
// this.diskon=diskon;
this.voucher=voucher;
this.poin=poin;
}
public int getDiskon(){
return diskon;
}
public int getPoinTambah(){
return (harga/50000*10);
}
public int getVoucher(){
return voucher;
}
public int getBayar(){
return (harga-(harga/diskon));
}
public int getDiskonVoucher(){
return harga-voucher;
}
public int getDiskonPoin(int p){
return p*1000;
}
public int getPoinSkrg(){
return poin+harga/50000*10;
}
}
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar