Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2015
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. import java.util.Scanner;
  2. class Banking{
  3.  
  4.  
  5. public static void main(String args[]){
  6. double balance=0;
  7. double rate;
  8. double period;
  9. double totalinterest;
  10.  
  11. double lastdpamnt=0;
  12.  
  13. double dpamnt=0;
  14. Scanner sc=new Scanner(System.in);
  15.  
  16.  
  17. System.out.println("enter name");
  18. String name=sc.nextLine();
  19.  
  20.  
  21. System.out.println("WELCOME TO DEP BANK");
  22. System.out.println("1.View 2.Deposit 3.Interest 4.View last deposit amount 5.Exit");
  23. int choice=sc.nextInt();
  24.  
  25.  
  26. switch(choice){
  27. case 1:
  28. System.out.println("Customer Name: "+name);
  29. System.out.println("your account balance="+balance);
  30.  
  31. break;
  32.  
  33. case 2:
  34. System.out.println("enter amount to deposit");
  35. dpamnt=sc.nextDouble();
  36. balance=balance+dpamnt;
  37. System.out.println("current balance="+balance);
  38. break;
  39. case 3:
  40. System.out.println("enter rate");
  41. rate=sc.nextDouble();
  42. System.out.println("enter period");
  43. period=sc.nextDouble();
  44. rate=10;
  45. double interest=balance*rate*period/100;
  46.  
  47.  
  48.  
  49.  
  50. System.out.println("interest="+interest);
  51. break;
  52. case 4:
  53. lastdpamnt=dpamnt;
  54. System.out.println("Last deposit amount="+lastdpamnt);
  55. break;
  56.  
  57. case 5:break;
  58.  
  59.  
  60. }
  61.  
  62.  
  63.  
  64. }
  65.  
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement