Boiling Point Of Water(if…else)

Q14. Program to obtain boiling point of water from user and report whether the user has entered the correct answer or not. Make use of if…else statement.

(Hint. Boiling point of water is 100C.)

Sol:

Create a GUI application as per following screenshot.

 

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

String t1=txt1.getText();

double temp=Double.parseDouble(t1);

if(temp==100)

lbl1.setText(“You are right. It is 100C”);

else

lbl1.setText(“No. It is 100C”);

}

 

OUTPUT:

Leave a Reply

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