Finance Sector

 

Finance Sector



Problem Description


Raj deposit $10000 into a bank account paying 7% simple interest per year. He left the money in for 5 years. Find the interest earned and the amount at the end of those 5 years by Raj? Help him to find the interest and amount resided in bank after 5 years?


STEP 1: Find an interest by using the formula

I=P<=i<=t, where I is interest, P is total principal, i is rate of interest per year, and t is total time in years.


STEP 2: Find an amount by using the formula A=P+I.


Input and Output Format:


Refer sample input and output for formatting specification.


All float values are displayed correct to 2 decimal places.


All text in bold corresponds to input and the rest corresponds to output.

Logic Test Case 1


Input (stdin)

10000


7


5


Expected Output


Interest= 3500


Amount= 13500

Logic Test Case 2


Input (stdin)

20000

8


4


Expected Output


Interest= 6400


Amount= 26400



Code Area

import java.io.*;

import java.util.Scanner;

public class TestClass

{

    public static void main(String args[]) 

    {

        int p, r, t;

        Scanner s = new Scanner(System.in);

        p = s.nextInt();

        r = s.nextInt();

        t = s.nextInt();

        int si,A;

        si = (r * t * p) / 100;

      A=p+si;

        System.out.println("Interest= " + si);

      System.out.print("Amount= "+A);

    }

}


Post a comment

0 Comments