Computer Applications
A certain amount of money is invested for 3 years at the rate of 6%, 8% and 10% per annum compounded annually. Write a program to calculate:
- the amount after 3 years.
- the compound interest after 3 years.
Accept certain amount of money (Principal) as an input.
Hint: A = P * (1 + (R1 / 100))T * (1 + (R2 / 100))T * (1 + (R3 / 100))T and CI = A - P
Java
Input in Java
42 Likes
Answer
import java.util.Scanner;
public class KboatCompoundInterest
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter the principal: ");
double principal = in.nextDouble();
System.out.println(principal);
float r1 = 6.0f, r2 = 8.0f, r3 = 10.0f;
double amount = principal * (1 + (r1 / 100)) * (1 + (r2 / 100)) * (1 + (r3 / 100));
double ci = amount - principal;
System.out.println("Amount after 3 years: " + amount);
System.out.println("Compound Interest: " + ci);
}
}
Variable Description Table
Program Explanation
Output
Answered By
20 Likes
Related Questions
The co-ordinates of two points A and B on a straight line are given as (x1,y1) and (x2,y2). Write a program to calculate the slope (m) of the line by using formula:
Slope = (y2 - y1) / (x2 - x1)
Take the co-ordinates (x1,y1) and (x2,y2) as input.
Write a program to input two unequal numbers. Display the numbers after swapping their values in the variables without using a third variable.
Sample Input: a = 76, b = 65
Sample Output: a = 65, b = 76
The driver took a drive to a town 240 km at a speed of 60 km/h. Later in the evening, he drove back at 20 km/h less than the usual speed. Write a program to calculate:
- the total time taken by the driver
- the average speed during the whole journey
[Hint: average speed = total distance / total time]
A dealer allows his customers a discount of 25% and still gains 25%. Write a program to input the cost of an article and display its selling price and marked price.
Hint: SP = ((100 + p%) / 100) * CP and MP = (100 / (100 - d%)) * SP