Showing posts with label java jframe. Show all posts
Showing posts with label java jframe. Show all posts

Tuesday, October 20, 2015

Simple Interest Calculation using jframe(Java GUI)

Write a Java program to calculate a simple interest. This program must be focused on an object oriented approach.

video tutorial link: video

N.B. : Java source code is case sensitive
Source code:  java_simple_interest . java

package java_simple_interest;
class simple_interest
    //instance variable
    float principal_amount;
    float year_of_interest;
    float rate_of_interest;
    //method with arguments and return type
    float si(float pa, float yi, float ri)
        return pa*yi*ri;

Source Code: calculate_simple_interest . java

(Source code under action button ( jButton1 ))

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        

 // TODO add your handling code here:
        //create object
        simple_interest si =new simple_interest();
        //instance variable getting value from text box
        //method si called by object si
        jLabel4.setText ("Your Payable interest  is: " +,si.rate_of_interest ,si.principal_amount ));