Computer Science, asked by ayush3027, 3 months ago


Write a program in Java that uses 'input using initialisation to calculate the simple Interest and the Total Amount with
the given values:
(i) . Principle Amount = Rs. 20000
(ii) Rate = 8.98%
(iii) Time = 3 years

Answers

Answered by BrainlyProgrammer
9

Question:-

  • Write a program in Java that uses 'input using initialisation to calculate the simple Interest and the Total Amount with
  • the given values:
  • (i) . Principle Amount = Rs. 20000
  • (ii) Rate = 8.98%
  • (iii) Time = 3 yyear

Answer:-

package Coder;

public class Interest

{

public static void main(String[] args)

{

int p=20000;

double r=8.98;

int t=3;

double i=(p*r*t)/100;

double a=i+p;

System.out.println("Interest="+i+"\nAmount="+a);

}

}

_______

Variable Description:-

  1. p :- To store principle
  2. r:- to store rate of interest
  3. t:- to store time
  4. i:- to store interest
  5. a:- to store amount

____

•Output Attached

Attachments:
Answered by Oreki
3

public class SimpleInterest {

   public static void main(String[ ] args) {

       double principal = 20_000,

                    rate = 8.98;

       int time = 3;

       

       double simpleInterest = (principal * rate * time) / 100,

                    totalAmount = principal + simpleInterest;

       

       System.out.println("Simple Interest - ₹" + simpleInterest);

       System.out.println("Total amount - ₹" + totalAmount);

   }

}

Similar questions