Attached File(s)

P3IP.zip (34.63K)
Number of downloads: 487
Posted 30 April 2009  04:15 PM
Posted 30 April 2009  05:39 PM
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // First we define float variables. float price, down, interest, length, result; // We have to parse the text to a type float. price = Float.parseFloat(jTextField1.getText()); down = Float.parseFloat(jTextField2.getText()); interest = Float.parseFloat(jTextField3.getText()); length = Float.parseFloat(jTextField4.getText()); // Now we can perform the calculation interest = interest / 100 / 12; float ipow = (float)java.lang.Math.pow(1 + interest, length); interest = (interest * ipow) / (ipow  1); result = (price  down) * interest; // We will now pass the value of result to jTextField3. // At the same time, we are going to // change the value of result from a float to a string. jTextField5.setText(String.valueOf(result)); }
Posted 30 April 2009  06:25 PM