Simple Interest Programme.

Q16. Design Java Netbeans 6.5.1 an application that accepts principal amount, rate of interest and time from the user. Then it computes the simple interest and displays it.

Sol:

Create a GUI application as per following screenshot.

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

jTextField1.setText(“”);

jTextField2.setText(“”);

jTextField3.setText(“”);

jTextField4.setText(“”);

jTextField5.setText(“”);

}

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

double prin,rate,time,sim,total;

prin=Double.parseDouble(jTextField1.getText());

rate=Double.parseDouble(jTextField2.getText());

time=Double.parseDouble(jTextField3.getText());

sim=(prin*rate*time)/100;

jTextField4.setText(sim+””);

total=prin+sim;

jTextField5.setText(total+””);

}

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

System.exit(0);

}

Output: