Ronnie72428

MATURITY

Dec 9th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.36 KB | None | 0 0
  1. import java.util.*;
  2. class Menu_Driven{
  3.     public static void main(String args[])    {
  4.         System.out.println("Enter your choice.");
  5.         System.out.println("1. Term Deposit");
  6.         System.out.println("2. Recurring Despot");
  7.        
  8.         Scanner sc = new Scanner(System.in);
  9.        
  10.         int choice = sc.nextInt();
  11.        
  12.         System.out.println("Enter the principal.");
  13.         double principal = sc.nextDouble();
  14.        
  15.         System.out.println("Enter the rate.");
  16.         double rate = sc.nextDouble();
  17.  
  18.         double amount = 0.0;
  19.        
  20.         switch(choice){
  21.             case 1:{
  22.                 System.out.println("Enter the time in years");
  23.                 int time = sc.nextInt();
  24.                 amount = ( principal * ( Math.pow( ( 1 + ( rate/100.0 ) ), time ) ) );
  25.                 System.out.println("The maturity amount is " +amount);
  26.                 break;
  27.             }
  28.             case 2:{
  29.                 System.out.println("Enter the time in months");
  30.                 int time = sc.nextInt();
  31.                
  32.                 /*
  33.                  *
  34.                  * ENTER CODE HERE
  35.                  *
  36.                  */
  37.                
  38.                
  39.                 break;
  40.             }
  41.             default:{
  42.                 System.out.println("Invalid input.");
  43.             }
  44.         }
  45.     }
  46. }
Add Comment
Please, Sign In to add comment