- Fields:
int customerId;
String firstName;
String lastName;
String city;
- Constructors:
... Customer(){...};
... Customer(int customerId, String firstName, String lastName, String city){...};
- Getter and Setter Methods
-
toString(){...};
method -
Constants:
CHECKING
(Checking Account),SAVINGS
(Savings Account),CREDIT
(Credit Account)
- Fields:
int accountId;
int customerId;
double balance;
AccountType accountType;
- Constructors:
... Account(){...};
... Account(int accountId, int customerId, AccountType accountType){};
- Getter and Setter Methods
depositToAmount(double amount)
method (Deposit Money)withdrawFromAmount(double amount)
method (Withdraw Money)toString()
method
- Fields:
Map<Integer, Customer> customers;
List<Account> accounts;
Scanner scanner;
- Constructors:
BankSimulation() {
customers = new HashMap<>();
accounts = new ArrayList<>();
scanner = new Scanner(System.in);
}
- Main Method
public static void main(String[] args){
...
}
run()
methodlistCustomers()
methodlistCustomerAccounts(Customer customer)
methodaddCustomer()
methodcustomerOperationsMenu()
methodcustomerOperations(Customer customer)
methodopenNewAccount(Customer customer)
methoddepositToAccount(Customer customer)
methodwithdrawFromAccount(Customer customer)
methodcheckBalance(Customer customer)
methodgetAccountById(int accountId)
method
BankingSystem
├── src
│ ├── Customer.java
│ ├── AccountType.java
│ ├── Account.java
│ └── BankSimulation.java
└── README.txt (Optional)
- Create the project structure and place the given classes in their respective files.
- Implement getter and setter methods in the "Customer" class.
- Implement
depositToAmount()
andwithdrawFromAmount()
methods in the "Account" class. - Complete the customer addition and listing functions in the "BankSimulation" class.
- Complete the new account creation and account transaction functions in the "BankSimulation" class.
- Start the application in the
main
method and handle user interactions through the user interface.
- Implement appropriate error handling for invalid inputs (optional).
- The
BankSimulation
class manages banking operations and provides the main user interface. Themain
method is located in this class and starts the banking simulation. Therun
method creates the main menu and directs operations based on user inputs. - The
Customer
class represents bank customers and contains customer details. - The
Account
class represents bank accounts and contains account-related information. It also includes transaction methods such aswithdrawFromAmount
(withdraw money) anddepositToAmount
(deposit money). - The
AccountType
enum represents different types of accounts: checking, savings, and credit. - The
BankSimulation
class utilizescustomers
andaccounts
variables asfinal
to prevent reference changes, ensuring better security and control. However, while the reference itself cannot be modified, the contents of theHashMap
andList
can still be updated as needed.
- Zafer Atakli
This project is open-source and available under the MIT License.