Guest User

Untitled

a guest
Oct 18th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5.  
  6. package BankAccount;
  7. import java.util.Scanner;
  8.  
  9. /**
  10. *
  11. * @author jdv10707
  12. */
  13. public class BankAccount
  14. {
  15. public static void main(String[] args)throws Exception
  16. {
  17. Scanner input = new Scanner(System.in);
  18. BankSavings myBankSavings=new BankSavings();
  19. int mySavings,Withdraw,Deposit;
  20. int choice;
  21.  
  22. System.out.println("The Bank Account");
  23. System.out.println("----------------------------------------------------");
  24. System.out.println("[1] Display current Savings");
  25. System.out.println("[2] Withdraw");
  26. System.out.println("[3] Deposit");
  27. System.out.println("[4] Exit");
  28. System.out.println("----------------------------------------------------");
  29.  
  30. System.out.print("Enter Your Savings: ");
  31. mySavings = Integer.parseInt(input.nextLine());
  32. myBankSavings.setmySavings(mySavings);
  33. for(;;)
  34. {
  35. System.out.print("Enter Your Choice: ");
  36. choice = Integer.parseInt(input.nextLine());
  37.  
  38. switch(choice)
  39. {
  40. case 1:
  41. System.out.printf("Your current savings: P%d\n\n",myBankSavings.getmySavings());
  42. break;
  43.  
  44. case 2:
  45. System.out.printf("Enter the amount to withdraw: ");
  46. Withdraw = Integer.parseInt(input.nextLine());
  47. mySavings-=Withdraw;
  48. myBankSavings.setmySavings(mySavings);
  49. break;
  50.  
  51. case 3:
  52. System.out.printf("Enter the amount to Deposit: ");
  53. Deposit = Integer.parseInt(input.nextLine());
  54. mySavings+=Deposit;
  55. myBankSavings.setmySavings(mySavings);
  56. break;
  57.  
  58. }}
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65. }
  66. }
Add Comment
Please, Sign In to add comment