4. Coding
• Double click the exit button and type the
following code as it is: System.exit(0);
• Then double click the clear button and type
the following code in it:
• jTextField1.setText("");
• jTextField2.setText("");
• jTextField3.setText("");
5.
6. Coding
• Double click the add button and type the
following coding in it:
• Float num1, num2, result;
• num1= Float.parseFloat(jTextField1.getText());
• num2= Float.parseFloat(jTextField2.getText());
• result= num1 + num2;
• jTextField3.setText(String.valueOf(result));
7. • Double click the subtract button and type the
following coding in it:
• Float num1, num2, result;
• num1= Float.parseFloat(jTextField1.getText());
• num2= Float.parseFloat(jTextField2.getText());
• result= num1 - num2;
• jTextField3.setText(String.valueOf(result));
8. • Double click the multiply button and type the
following coding in it:
• Float num1, num2, result;
• num1= Float.parseFloat(jTextField1.getText());
• num2= Float.parseFloat(jTextField2.getText());
• result= num1 * num2;
• jTextField3.setText(String.valueOf(result));
9. • Double click the divide button and type the
following coding in it:
• Float num1, num2, result;
• num1= Float.parseFloat(jTextField1.getText());
• num2= Float.parseFloat(jTextField2.getText());
• result= num1 / num2;
• jTextField3.setText(String.valueOf(result));