Menghitung total pendapatan Hotel Dengan Java NetBeans
Source Code :
package hotel;
/**
*
* @author kamu
*/
import java.io.*;
public class UAS {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
String nama="",kamar="";
int jenis=0,status=0,lama=0,tarif=0;
double diskon=0,bayar=0, pajak=0;
BufferedReader br = new BufferedReader(new InputStreamReader (System.in));
//input
System.out.println("--**-- Sistem Informasi Hotel ABC --**--");
System.out.print("Nama Pelanggan \t\t\t: ");
nama = br.readLine();
System.out.println("\nPilih Kategori Kamar");
System.out.println("1. VIP Rp 500.000/hari");
System.out.println("2. Menengah Rp 250.000/hari");
System.out.println("3. Ekonomi Rp 150.000/hari");
System.out.print("Jenis kamar yang dipesan \t: ");
jenis = Integer.parseInt(br.readLine());
System.out.print("\nLama Menginap \t\t\t: ");
lama = Integer.parseInt(br.readLine());
System.out.println("\nStatus Pelanggan");
System.out.println("1. Member");
System.out.println("2. Non Member");
System.out.print("Pilih status pelanggan \t\t: ");
status = Integer.parseInt(br.readLine());
//proses perhitungan
if (jenis==1){
tarif = lama*500000;
pajak = 0.10;
pajak = tarif * pajak;
kamar="VIP";
}else if (jenis==2){
tarif = lama*250000;
pajak = 0.05;
pajak = tarif * pajak;
kamar="Menengah";
}else if (jenis==3){
tarif = lama*150000;
pajak = 0.02;
pajak = tarif * pajak;
kamar="Ekonomi";
}
if (status==1){
if(lama>=4 && lama<=7){
diskon = 0.20 * tarif;
}else if (lama>7) {
diskon = 0.35 * tarif;
}
}else if (status==2){
if (lama>=4 && lama<=7){
diskon = 0.10 * tarif;
}else if (lama>7){
diskon = 0.15 * tarif;
}
}
bayar = tarif + pajak-diskon;
//output
System.out.println("\n\n---***--- NOTA PEMBAYARAN HOTEL ABC ---***---");
System.out.println("Nama Pelanggan \t\t\t: " + nama);
System.out.println("Jenis Kamar \t\t\t: " + kamar);
System.out.println("Tarif Penginapan \t\t: Rp " + tarif + ",-");
System.out.println("Diskon Menginap \t\t: Rp " + diskon + ",-");
System.out.println("Nominal yang harus dibayar \t: Rp " + bayar + ",-");
System.out.println("====================================================");
}
}
Output :
Comments
Post a Comment