Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chizuru-nina-yamauchi/automated-teller-machine-atm-system
My assignment for ATM System with design patterns, file handling, CLI operations.
https://github.com/chizuru-nina-yamauchi/automated-teller-machine-atm-system
factory-method-pattern singleton-pattern
Last synced: 6 days ago
JSON representation
My assignment for ATM System with design patterns, file handling, CLI operations.
- Host: GitHub
- URL: https://github.com/chizuru-nina-yamauchi/automated-teller-machine-atm-system
- Owner: chizuru-nina-yamauchi
- Created: 2024-02-14T08:44:48.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-02-18T16:00:37.000Z (9 months ago)
- Last Synced: 2024-02-19T16:58:41.083Z (9 months ago)
- Topics: factory-method-pattern, singleton-pattern
- Language: Java
- Homepage:
- Size: 2.23 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
My assignment for ATM System with Factory Method Pattern, Singleton Pattern
---
# Automated Teller Machine (ATM) System in Java
## Introduction
This project is an exciting opportunity to delve into the world of Java programming by developing an Automated Teller Machine (ATM) system. This system will not only allow you to apply basic Java programming concepts but also explore more advanced features such as file handling, Command Line Interface (CLI) operations, and design patterns. The ATM system will simulate real-world banking operations such as balance inquiries, deposits, withdrawals, and fund transfers, all managed through text files instead of a database. This approach emphasizes the importance of file I/O in Java and provides a practical scenario to implement object-oriented programming principles. By completing this assignment, you will gain valuable experience in developing a comprehensive Java application that incorporates a wide range of programming concepts and techniques.
## Features and Implementation Guide
### Design Patterns Requirement
**Objective:** Apply design patterns to enhance code modularity, reusability, and maintainability.
**Implementation Guide:**
- **Factory Method Pattern:** Use this pattern for creating objects without specifying the exact class of object that will be created. This is particularly useful for creating different types of transactions (e.g., deposit, withdrawal, transfer) based on user input.
**Hint:** Define a `factories` class with a method that returns different `transactions.transactions` objects based on the transactions type.
- **Singleton Pattern:** Although we are not managing database connections, the Singleton pattern is still valuable for managing access to the file that stores user records. This ensures that only one instance of the file manager exists throughout the application, preventing concurrent file access issues.
**Hint:** Implement a `file.FileManager` class as a Singleton, which will handle all read and write operations to the user records file.
### users.User Authentication
**Objective:** Verify user credentials against information stored in text files.
**Implementation Guide:**
- Store user data (username, password, balance) in a text file.
- Read the file and search for the username and password entered by the user.
- If a match is found, grant access; otherwise, display an error message.### Balance Inquiry
**Objective:** Display the user's current balance.
**Implementation Guide:**
- After successful login, read the user's balance from the file.
- Display the balance to the user.### Deposit Funds
**Objective:** Allow users to deposit money into their account.
**Implementation Guide:**
- Prompt the user for the amount to deposit.
- Update the user's balance in the file.
- Confirm the deposit to the user.### Withdraw Funds
**Objective:** Enable users to withdraw money, ensuring the amount does not exceed their current balance.
**Implementation Guide:**
- Ask the user for the withdrawal amount.
- Check if the balance is sufficient.
- If so, update the balance in the file and confirm the withdrawal; otherwise, display an error message.### Transfer Funds
**Objective:** Allow users to transfer funds to another user.
**Implementation Guide:**
- Prompt for the recipient's username and transfer amount.
- Verify both users' existence and balance sufficiency.
- Update both users' balances in the file.### Change PIN
**Objective:** Users can change their password.
**Implementation Guide:**
- Verify the current password.
- Prompt for a new password and update it in the user's record.### Additional Advanced Features
Continue with the advanced features as previously outlined, including transactions.transactions History, Scheduled Transactions, Account Alerts, Multi-Currency Support, users.User Profile Management, and Security Enhancements.
### JUnit Testing
**Objective:** Ensure the reliability and functionality of the ATM program.
**Implementation Guide:**
- Write unit tests for individual methods, focusing on edge cases and expected behavior.
- Implement integration tests to verify the system's behavior as a whole.## Submission Guidelines
- Include all source files, test cases, and text files for user records.
- Ensure your code is well-commented and adheres to Java coding standards.
- Provide a report documenting your design decisions and any challenges encountered.## Evaluation Criteria
- Correct implementation of required features.
- Effective application of Java concepts and design patterns.
- Code quality and organization.
- Comprehensive JUnit tests.This assignment is designed to challenge your Java programming skills and encourage you to think critically about software design and implementation.
***Good luck!*** :wink:
---
## My Result
- JUnit test passed
![testPic](./main/resources/testResult1.png)
- Using ATM
![pic1](./main/resources/pic1.png)
![pic2](./main/resources/pic2.png)
![pic3](./main/resources/pic3.png)
![pic4](./main/resources/pic4.png)
- Error handling
-- Login Fail![loginFailPic](./main/resources/loginFailPic.png)
- Error handling
-- Deposit Fail
(Deposit amount has to be positive amount)![depositFail](./main/resources/depositFailPic.png)
- Error handling
-- Deposit spell mistake(*It doesn't matter if it is with Capital or lower case)![depositSpellMistake](./main/resources/depositMisSpellPic.png)
- Error handling
-- Withdrawal spell mistake![withdrawalSpellMistake](./main/resources/withdrawalMisSpellPic.png)
- Error handling
-- Transfer Fail(recipient not found -> return to the main menu)![recipientNotFound](./main/resources/recipientUsernameError.png)
- Error handling
-- Change PIN Fail(Passwords don't match 3 times -> return to the main menu)![passwordNotMatch](./main/resources/passwordNotMatch.png)
## Resources
- https://www.digitalocean.com/community/tutorials/java-singleton-design-pattern-best-practices-examples (Singleton Pattern)
- Head First Java 3rd Edition(serialization and file I/O)
- https://en.wikipedia.org/wiki/Factory_method_pattern (Factory Method Pattern: Wikipedia)
- https://www.baeldung.com/java-factory-pattern (Factory Method Pattern)