Computer Science, asked by ashwinilakhan6, 5 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 anamtaany31
0

Answer:

import java .util .*;

class Sample{

public static void main (String args[]){

Scanner sc=new Scanner (System.in);

double p,r,SI,CI,AV,d;int t

System.out.println("Enter principal:");

p=sc.nextDouble();

System.out.println("Enter rate:");

r=sc.nextDouble();

System.out.println("Enter time:");

t=sc.nextInt();

SI=p(1+rt);

CI=Math .pow(p(1+r/t),rt);

if (SI>CI)

d=SI-CI;

else if

d=CI-SI;

AV=Math.abs(d);

System.out.println("Simple interest ="+SI);

System.out.println("Compound Interest="+CI)

System.out.println("Absolute value of the difference="+);

Similar questions