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
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:-
- p :- To store principle
- r:- to store rate of interest
- t:- to store time
- i:- to store interest
- a:- to store amount
____
•Output Attached
Attachments:
Answered by
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
Biology,
1 month ago
Math,
1 month ago
Computer Science,
3 months ago
Hindi,
3 months ago
Math,
9 months ago
CBSE BOARD XII,
9 months ago