CSC 325 Bank Account – Part 2
Question Description
Modify the Bank Account class you created to have the following additional functionality
- When the object is created, it should create two types of account
- Checking and Saving ( you can user Boolean variables to identify between these accounts)
- Initialize balance on both accounts to $0
- The constructor calls a method called setAccountPassWord()
setAccountPassWord ()
- This method asks the user to enter a pin number.
- It checks to make sure the Pin number is between 4-8 digit numerical value
- It calls another method called encryptData()
- the value return from enCryptData is stored as the user security pin number.
enCryptData()
- This method takes integer value as its argument
- It encrypts the integer value using mod21 encryption security.
- Returns the encrypted value to calling function.
Example
12345 %21 – this returns 18 which is the remainder
656564 % 21 – this returns 20 which is the remainder
Add the following additional methods
Withdraw ()
- Asks for security pin.
- Checks if pin entered matches the user security
- If not, continue to ask user for security pin until valid pin is entered.
- Asks if withdraw from checking account or saving account
- Checks If withdraw amount is less than balance
- Withdraws the amount, and updates account balance
Deposit()
- Asks for security pin.
- Checks if pin entered matches the user security
- If not, continue to ask user for security pin until valid pin is entered.
- Asks if withdraw from checking account or saving account
- Updates account balance with new balance
Transfer()
- Asks for security pin.
- Checks if pin entered matches the user security
- If not, continue to ask user for security pin until valid pin is entered.
- Asks from and to account to transfer money (checking to saving or saving to checking_
- Updates both accounts balance
DisplayBalance()
- Asks for security pin.
- Checks if pin entered matches the user security
- If not, continue to ask user for security pin until valid pin is entered.
- Prints the account balance on both checking and Saving
Test your code with the followings
- Create an account called myAccount
- Call DisplayBalance()
- Deposit $100 in saving account
- Deposit $150 in checking account
- Display Balance
- Transfer $50 from saving account into checking account
- Display balance
- Try to withdraw $200 from your saving account and see what happens.You must properly display code and inform the end user if there is not funding in the account
- Withdraw $25 from saving account
Display Balance