Let us create a program that will accept the amount and the time for fixed deposit and calculate the interest along with the Net Payable amount

 Let us create a program that will accept the amount and the time for fixed deposit and calculate the interest along with the Net Payable amount



public class FixedDeposit
{
   int amount;
   float time;
   float interest;
   float total;
   static float rate = 8.5f;
   public void accept(int a , float t){
       amount=a;
       time=t;
    }
   public void calc(){
       interest =(amount*time*rate)/100;
       total=amount+interest;
    }
   public void display(){
       System.out.println("Amount: "+amount);
       System.out.println("Time: "+time);
       System.out.println("Rate: "+rate);
       System.out.println("**************************");
       System.out.println("Interest: "+interest);
       System.out.println("Net Payable Amount: "+total);
    }
   public static void main(String args[]){
       FixedDeposit obj = new FixedDeposit();
       obj.accept(5000,4);
       obj.calc();
       obj.display();
    }
}

Output
Amount: 5000 Time: 4.0 Rate: 8.5 ************************** Interest: 1700.0 Net Payable Amount: 6700.0

Comments

Popular posts from this blog

Make a GST Calculator using HTML and JavaScript

How to make simple bill maker by using python tkinter

Write a program to find the sum of 1/2+4/3+5/6+8/7+9/10 using loop in java