Computer Science, asked by ashwinilakhan6, 7 months ago

Write a program in Java that takes input using the Scanner class to

calculate the Simple Interest and the Compound Interest with the given values:

i. Principle Amount = Rs.1,00,000

ii. Rate = 11.5%

iii. Time = 5 years

Display the following output:

i. Simple interest

ii. Compound interest

iii. Absolute value of the difference between the simple and compound interest.​

Answers

Answered by zack1706
4

Explanation:

import java.util.Scanner;

public class JavaExample

{

public static void main(String args[])

{

float p, r, t, sinterest;

Scanner scan = new Scanner(System.in);

System.out.print("Enter the Principal : ");

p = scan.nextFloat();

System.out.print("Enter the Rate of interest : ");

r = scan.nextFloat();

System.out.print("Enter the Time period : ");

t = scan.nextFloat();

scan.close();

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

System.out.print("Simple Interest is: " +sinterest);

}

}

Similar questions