All Chapter Rental Multimedia
package Rental_Multimedia; import java.util.Scanner; import java.text.DecimalFormat;
import javax.swing.JOptionPane; public class Rentalindo { public static String NAME ="PT.RENTALINDO VISUAL MANDIRI PALEMBANG",CITY="\nPT.RENTALINDO VISUAL MANDIRI JAKARTA"; public static String getName(){ return NAME; } public static String getCity(){ return CITY;
} public static double hargaBarang(int jHS, double hGP){ double UM; if (jHS<0) return 0; else UM=jHS*hGP; return UM; }
/** * @param args */
public static void main(String[] args) { // TODO Auto-generated method stub
Scanner input=new Scanner(System.in); String array[]={">PROJECTOR",">TV PLASMA",">CAMERA",">HT",">LED"}; String confirm=""; int rows=1; int cols=5; int [ ] [ ] twoD=new int[rows][cols]; int n=0;
int x; String theName= getName(), theCity= getCity();
System.out.print("\n
\f *** HELLO *** \f\n\n");
System.out.print("--------------------------------------\n"); System.out.print("|TEAM :\f *KELOMPOK G* \f System.out.print("|KELAS :
TI. 12
|\n");
|\n");
System.out.print("|TEMA :RENTAL MULTIMEDIA (RENTALINDO)|\n"); System.out.print("--------------------------------------\n"); System.out.print(" System.out.print("
*RENTALINDO VISUAL MANDIRI*\n"); (Rental Multimedia) \n\n");
System.out.print(theName+"\n
Merupakan Cabang Dari "+theCity);
System.out.print("\n\n*****"); System.out.print("\nPT.RENTALINDO VISUAL MANDIRI ini bergerak di dalam bidang penyewaan alat-alat Multimedia."); System.out.print("\nYang dapat membantu dalam penyelenggaran acara anda, dengan kualitas alat yang baik,"); System.out.print("\nDan dengan harga yang terjangkau pula."); System.out.print("\n");
twoD[0][0]=1; twoD[0][1]=2; twoD[0][2]=3; twoD[0][3]=4; twoD[0][4]=5;
JOptionPane.showMessageDialog(null, "Welcome To Rentalindo (Multimedia) \n");
char[] ch1={'.'}; for (char daftar1:ch1){ System.out.print("\n"); System.out.print("\n\f~DAFTAR HARGA BARANG MULTIMEDIA~\f"); System.out.print("\n========================================================== ======\n"); System.out.print("\n\f1.PROJECTOR"); switch (daftar1){ case'.':System.out.print(daftar1+"Rp.1.000.000/hari"); break; } char []ch2={'.'}; for (char daftar2:ch2){ System.out.print("\n\f2.TV PLASMA"); switch (daftar2){ case'.':System.out.print(daftar2+"Rp.600.000/hari"); break; } char []ch3={'.'}; for (char daftar3:ch3){ System.out.print("\n\f3.CAMERA"); switch (daftar3){
case'.':System.out.print(daftar3+" Rp.800.000/hari"); break; }
char []ch4={'.'}; for (char daftar4:ch4){ System.out.print("\n\f4.HT"); switch (daftar4){ case'.': System.out.print(daftar4+"
Rp.150.000/hari"); break;
} char []ch5={'.'}; for (char daftar5:ch5){ System.out.print("\n\f5.LED"); switch (daftar5){ case'.':System.out.print(daftar5+"
Rp.1.500.000/hari"); break;
} System.out.print("\n========================================================== ======"); System.out.print("\n\nmasukan no barang yang akan anda sewa = ");
x= input.nextInt(); if (x==1){ System.out.print(array[0]+"\n Harga Rp.1.000.000 /hari\n");
} else if (x==2){ System.out.print(array[1]+"\n Harga Rp.600.000 /hari\n");
} else if (x==3){ System.out.print(array[2]+"\n Harga Rp.800.000 /hari\n");
} else if (x==4){ System.out.print(array[3]+"\n Harga Rp.150.000 /hari\n");
} else if (x==5){ System.out.print(array[4]+"\n Harga Rp.1.500.000 /hari\n");
} else if(x>5) { System.out.print("maaf! no yang ada masukan tidak ada di daftar kami.");
}
do{
String inputjHS = JOptionPane.showInputDialog(null, "Masukkan Jumlah Hari Sewa ?"); int jHS = Integer.parseInt(inputjHS); System.out.println(" Jumlah Hari Sewa "+jHS+" hari");
String inputhGP = JOptionPane.showInputDialog(null, "Masukkan Harga Barang ?"); double hGP = Float.parseFloat(inputhGP);
double totalUM=hargaBarang(jHS,hGP); DecimalFormat myCurrFormatter = new DecimalFormat("$###,###,###"); String payrollCurrency = myCurrFormatter.format(totalUM); JOptionPane.showMessageDialog(null, "Total Harga Sewa : "+ payrollCurrency); System.out.println(" Total Harga Sewa Rp."+payrollCurrency);
confirm = JOptionPane.showInputDialog(null, "Ikuti Prosedure [Yes|No] : ");
} while ((confirm.charAt(0)== 'Y'));
while(true){
int answer = JOptionPane.showConfirmDialog(null,"\n"+"Apakah anda Akan Melakukan Pembayaran [YES|NO] ?","welcome to java",JOptionPane.INFORMATION_MESSAGE); if(answer == JOptionPane.NO_OPTION || answer == JOptionPane.CANCEL_OPTION){ System.exit(0); }
System.out.print(">Pembayaran\n"); String s=JOptionPane.showInputDialog(null,"Masukkan Uang Pembayaran "); System.out.println(" Pembayaran Awal Rp."+s);
String m=JOptionPane.showInputDialog(null,"Masukkan Sisa Pembayaran "); System.out.println(" Sisa Pembayaran Rp."+m);
try{ n=Integer.parseInt(s); System.out.println("\n");
} catch (NumberFormatException nfe ){
System.out.println("sorry");
System.out.println("\n output Massage \n"+ nfe.getMessage()); System.out.println("\n nooutput : \n"+ nfe.toString());
} System.out.print("
TERIMAKASIH
");
System.out.printf("\n****** MELANCARKAN ACARA ANDA ADALAH KEPUASAAN BAGI KAMI ******");
} } } } } } } }
MAKA, HASIL NYA :