Using Switch/case write a program offering the user the option of finding, Principal, rate, time and interest. Use variations of the formula: I=PRT/100.
Answers
Answered by
0
Explanation:
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