a)Write a program in Java to accept Principal, time and rate and calculate simple interest.
Print the result in the following format:
b)WriteaprogramtoacceptLengthandbreadthandcalculateareaof Rectangle.Print all in the following format: Length is --------- breadth is ------------ Area is -------------
c) Write a program to accept radius and calculate area of circle and its circumference. Print the result in the following format:
Radius is -----------
Area is -----------= Circumference is -------------
d)Write a program to accept 3 integer values (two sides and the height) and calculate the area of trapezium using formula:
area= 12 height(a b)
e) Write a program to accept employee number, Name and basic salary. Calculate House Rent Allowance which is 14.5% of the annual salary. Print the result in the following format:
Employee Number -------- Name -------------
Basic Salary ------------------ House Rent allowances --------------
Exercise 2.4
Principal is Rs ------------
Time is -------- years
Rate is --------%
Simple Interest is Rs. ------------
Answers
Answered by
0
ANSWER
import java.util.Scanner;
public class KboatCompoundInterest
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter Principal: ");
double p = in.nextDouble();
System.out.print("Enter Rate: ");
double r = in.nextDouble();
System.out.print("Enter Time: ");
int t = in.nextInt();
double amt = p;
for (int i = 1; i <= t; i++) {
double interest = (amt * r * 1) / 100.0;
amt += interest;
System.out.println("Amount after " + i
+ " year = " + amt);
}
}
Similar questions