A03
Due Date:
Saturday, September 30
File(s) to be submitted:
QuickATM.java
Sample Output:
SampleOutput.html
SUBMIT
/
Check
Quick ATM Program (Branches)
Synopsis
Create a basic ATM simulation in Java to handle
user authentication,
balance view,
deposit,
withdrawal,
and
PIN change
functionalities.
Operations:
The program provides an interface for the user to:
- Enter a PIN for authentication
- View their account balance
- Deposit funds
- Withdraw funds (given sufficient balance)
- Change their PIN
The initial balance is set to $5000 and the default PIN is "0923".
All amounts are integers,
no fractions allowed.
Details
The programs prompts the user to select one the following menu options:
- PIN (Enter PIN)
- This option is for users to authenticate themselves.
- If the user inputs "PIN",
prompt them to enter their personal identification number (PIN).
If the entered PIN matches the stored PIN ("0923" by default),
mark the user as authenticated
and inform them they've been successfully authenticated
(see sample outputs).
If the PIN doesn't match,
display a message indicating the PIN is incorrect and exit the program.
- Once a user has authenticated with the correct PIN
the menu is printed again.
- BAL (View Balance)
- When the user inputs the choice "BAL",
your program should display the current account balance.
For this operation,
authentication is not mandatory.
- DEP (Deposit)
- If the user chooses the option "DEP",
prompt them to enter an amount.
Add this amount to the account balance
and
display a message confirming the deposit and showing the new balance.
For this operation,
authentication is not mandatory.
- WD (Withdraw)
- For the choice "WD",
the user must be authenticated.
If they are not authenticated,
display an error message and prevent the withdrawal.
If they are authenticated,
prompt them to enter an amount to withdraw.
- Ensure that withdrawal amount does not exceed the account balance.
If the withdrawal amount is less than or equal to the account balance,
deduct the amount
and
display a success message along with the updated balance.
- CP (Change PIN)
- For the choice "CP",
the user must be authenticated.
If not,
display an error message.
If they are authenticated,
prompt them to enter a new PIN.
- Ensure the new PIN is different from the old PIN.
If they try to reuse the old PIN,
display an error message and exit.
- EXIT
- When the user inputs the choice "Exit",
your program should display a farewell message and then terminate.
If a user types any other option,
provide a message “Invalid choice” and exit.
Grading Scheme
- 10 points: Successful PIN input leading to authentication in PIN operation
- 5 points: Incorrect PIN input with an appropriate error message in PIN operation
- 5 points: BAL operation is implemented correctly and is allowed with no authentication
- 10 points: DEP operation is implemented correctly and is allowed with no authentication
- 5 points: Correctly displaying the new balance after deposit
- 10 points: WD operation is implemented correctly and is allowed after authentication only
- 5 points: Insufficient funds check with an appropriate error message for the WD operation
- 5 points: Correctly displaying the new balance after withdrawal for the WD operation
- 10 points: CP operation is implemented correctly and is allowed after authentication only
- 5 points: Ensuring new PIN is different from the old with an appropriate error message
- 10 points: Handling any invalid menu choices with an appropriate error message
- 5 points: In the welcome message, there is your name, not “N. Neveditsin”
- 5 points: Meaningful variable names
- 10 points: Code uses correct style (indentation, line length, etc.) and all necessary Javadocs
SUBMIT
/
Check