| 57 | |
| 58 | // function to withdraw money from an existing account - |
| 59 | public void withdrawMoney() { |
| 60 | double witAmt = 0; |
| 61 | do { |
| 62 | System.out.println("Enter amount that you want to withdraw: "); |
| 63 | witAmt = sc.nextDouble(); |
| 64 | // check if withdrawal amount is less than balance, only proceed if true - |
| 65 | if (witAmt > balance) { |
| 66 | System.out.println("Account balance is less! Cannot withdraw...transaction failed!"); |
| 67 | } |
| 68 | } while (witAmt > balance); |
| 69 | balance = balance - witAmt; |
| 70 | System.out.println("Your current balance is: " + balance); |
| 71 | } |
| 72 | |
| 73 | // function to check balance of existing account - |
| 74 | public void checkBal() { |