import java.util.*; public class CompoundInterest { public static void main(String[] args) { double amount; double rate = 0; double time = 1; char group; Scanner keyboard = new Scanner(System.in); Scanner sc = new Scanner(System.in); System.out.println("Please enter an amount"); int p = sc.nextInt(); System.out.println("Please enter an account type (S, D, C or L"); group = keyboard.next() .charAt(0); switch(group) { case 'S' : rate = 3.0; break; case 'D' : rate = 0.5; break; case 'C' : rate = 1.5; break; case 'L' : rate = 4.0; } amount = p * Math.pow(1+rate, time); System.out.println("Value after one year is: " + amount +"" ); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)