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
Math,
2 months ago
Math,
2 months ago
Psychology,
2 months ago
Computer Science,
4 months ago
Hindi,
4 months ago
Math,
10 months ago
CBSE BOARD XII,
10 months ago