Calculate Mobile Bill Amount.

Q12. Design a Java Netbeans 6.5.1 GUI application to calculate mobile bill amount?

Criteria Table:

Calls Call Rate
1-100 1 Rs per call
101-200 1.20 Rs per call
201-300 1.50 Rs per call
Above 300 1.80 Rs per call

 Sol:

Create a GUI application as per following screenshot.

Type the following code by double clicking BtnCal, button, below the line that says, ‘// TODO add your handling code here’ 

double amt;

int call;

call=Integer.parseInt(txt1.getText());

if(call>=1&& call<=100)

amt=call*1;

else if(call<=200)

amt=100+(call-100)*1.20;

else if(call<=300)

amt=100+120+(call-200)*1.50;

else

amt=100+120+150+(call-300)*1.80;

lbl1.setText(amt+””);

}

OUTPUT:

Leave a Reply

Your email address will not be published. Required fields are marked *