Upload
mohd-syahmi
View
219
Download
0
Embed Size (px)
Citation preview
8/18/2019 cobaaaha
1/1
choice =Integer.parseInt(JOptionPane.showInputDialog ("What do you want to calculate? \n[1] Water Bill \n[2] Electricity Bill")); switch(choice) { case 1: JOptionPane.showInputDialog( null, "Water consumed:"); {
int water_consumed; if (water_consumed >0 &&water_consumed 100 &&water_consumed300 && water_consumed500) {units=water_consumed-500; water_amt=15*100+30*200+45*200+units*60;}
else {JOptionPane.showMessageDialog(null,"Wrong Unit Consumed Entered","ERROR",JOptionPane.ERROR_MESSAGE);}
JOptionPane.showMessageDialog(null,"CONSUMED UNITS~~~>"+water_consumed+"\nAmount of Electricity Bill~~>"+water_amt,"BILL CALCULATOR",JOptionPane.INFORMATION_MESSAGE); break;
} default:
JOptionPane.showMessageDialog(null,"Invalid Choice!","ERROR",JOptionPane.ERROR_MESSAGE);
break;}