Objective

The objective of this program is to allow bank administrator and customers utilize the features of a banking system. The bank administrator manages customer accounts and applying interest rates on savings account. A customer has a checking account and deposit account in which an amount can be deposited or withdrawn. A savings account is the same as checking account except that it has interest rates.

Main Class

The main class is the entry class of the program. It consists only the main method which allows a user to login and then redirects the user to the appropriate application (administrator or customer)

Main Method

This method asks for the user to enter the credentials of a user then redirects the user to the administrator menu or to the customer menu.

Pseudocode:

START
__INPUT account number
__INPUT account pin
____IF account is administrator THEN
______CALL AdminApplication.start()
____ELSE
______IF user exists and pin matches THEN
________CALL UserApplication.start(user)
______ELSE
________PRINT invalid credentials
______END IF
__END IF
END

Admin Application Class

This class is responsible for interacting with administrator features such as creating a new user, deleting a user, listing all users, and applying interest to savings accounts.

Start Method

This method handles the menu selection of administrator then redirects the action to the appropriate method.

Pseudocode:

START
____WHILE option is not 5
________INPUT option
________IF option is 1 THEN
____________CALL addNewUser()
________ELSE IF option is 2 THEN
____________CALL deleteUser()
________ELSE IF option is 3 THEN
____________CALL listAllUsers()
________ELSE IF option is 4 THEN
____________CALL applyInterestRates()
________ELSE IF option is 5 THEN
____________EXIT method
________ELSE
____________PRINT invalid option
________END IF
____END WHILE
END

Add User method

Add a new user to the database.

Pseudocode:

START
____INPUT account number
____INPUT account pin
____
____IF number and pin are not all digits and number is not unique and pin is not 5 digits THEN
________PRINT error
________RETURN
____END IF
____
____user = NEW User object
____SAVE user to database
END

Delete User Method

Delete a user from the database, only if the account's balance is empty.

Pseudocode:

START
____INPUT account number
____FIND user from the database
____
____IF user does not exist or user savings or checking balance is positive THEN
________PRINT error
________RETURN
____END IF
____
____DELETE user from database
END

List Users Method

Display all the account numbers of each user.

Pseudocode:

START
____FOR EACH user in the database
________PRINT user account number
____END FOR
END

Apply Interest Rates Method

Increase the balance of user's savings accounts based on an interest rate.

Pseudocode:

START
____INPUT number of months
____INPUT interest rate
____
____FOR EACH user in the database
________savingsAccount = get user's savings account
________CALL savingsAccount.applyInterestRate(number of months, interest rate)
____END FOR
END

User Application Class

This class is responsible for interacting with users to allow them to check balance, withdraw, or deposit.

Start Method

Shows the menu for a customer and redirects the call to the appropriate method.

Pseudocode:

START (user)
____WHILE option is not 7
________INPUT option
________IF option is 1 THEN
____________account = get user checking account
____________CALL getBalance(account)
________ELSE IF option is 2 THEN
____________account = get user checking account
____________CALL depositAmount(account)
________ELSE IF option is 3 THEN
____________account = get user checking account
____________CALL withdrawAmount(account)
________ELSE IF option is 4 THEN
____________account = get user savings account
____________CALL getBalance(account)
________ELSE IF option is 5 THEN
____________account = get user savings account
____________CALL depositAmount(account)
________ELSE IF option is 6 THEN
____________account = get user savings account
____________CALL withdrawAmount(account)
________ELSE IF option is 7 THEN
____________EXIT method
________ELSE
____________PRINT invalid option
________END IF
____END WHILE
END

Get Balance Method

Return the balance of a bank account.

Pseudocode:

START (bankAccount)
____balance = get bankAccount balance
____PRINT balance
END

Deposit Amount Method

Add an amount to the bank account.

START (bankAccount)
____INPUT amount
____CALL bankAccount.deposit(amount)
END

Withdraw Amount Method

Withdraw an amount from the bank account, only if there's enough balance.

Pseudocode:

START (bankAccount)
____INPUT amount
____
____IF insuffience funds THEN
________PRINT insufficient funds
________RETURN
____END IF
____
____CALL bankAccount.withdraw(amount)
END

Bank Account Interface

This class sets the rules for all types of bank account telling them that all accounts should have a withdraw and deposit methods.

Checking Account Class

A checking account implements the a bank account making it capable to withdraw and deposit an amount.

Deposit Method

Add an amount to the balance

Pseudocode:

START (amount)
____IF amount is not positive THEN
________Throw an error
____END IF
____balance = balance + amount
END

Withdraw Method

Withdraw an amount from the balance

Pseudocode:

START (amount)
____IF amount is not positive or amount is larger than the balance THEN
________Throw an error
____END IF
____balance = balance - amount
END

Savings Account Class

Savings account extends the Checking account therefore it has the same operations of withdraw and balance. An additional method to the savings account is the ability to apply interest rate.

Apply Interest Method

Pseudocode:

START (rate, number of months)
____IF number of months or rate is not positive THEN
________Throw an error
____END IF
____amount = balance x rate x number of months
____balance = balance + amount
END

User Account Class

This class is mainly used for encapsulating a user's number and PIN.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.