KnowledgeBoat Logo

Computer Applications

A certain amount of money is invested for 3 years at the rate of 6%, 8% and 10% per annum compounded annually. Write a program to calculate:

  1. the amount after 3 years.
  2. the compound interest after 3 years.

Accept certain amount of money (Principal) as an input.

Hint: A = P * (1 + (R1 / 100))T * (1 + (R2 / 100))T * (1 + (R3 / 100))T and CI = A - P

Java

Input in Java

42 Likes

Answer

import java.util.Scanner;


public class KboatCompoundInterest
{
    public static void main(String args[]) {
        
        Scanner in = new Scanner(System.in);
        
        System.out.print("Enter the principal: ");
        double principal = in.nextDouble();
        System.out.println(principal);
        
        float r1 = 6.0f, r2 = 8.0f, r3 = 10.0f;
        
        double amount = principal * (1 + (r1 / 100)) * (1 + (r2 / 100)) * (1 + (r3 / 100));
        double ci = amount - principal;
        
        System.out.println("Amount after 3 years: " + amount);
        System.out.println("Compound Interest: " + ci);
    }
}

Variable Description Table

Program Explanation

Output

BlueJ output of A certain amount of money is invested for 3 years at the rate of 6%, 8% and 10% per annum compounded annually. Write a program to calculate: (a) the amount after 3 years. (b) the compound interest after 3 years. Accept certain amount of money (Principal) as an input. Hint: A = P * (1 + (R1 / 100)) T * (1 + (R2 / 100)) T * (1 + (R3 / 100)) T and CI = A - P

Answered By

20 Likes


Related Questions