- Clone this repository and create your own.
- Open the project folder in VS Code.
- Install the 'Extension Pack for Java' extension
- If you're getting an error about needing to install the JDK and you have already installed it, it means that you need to set your environment variables properly.
- Complete each exercise in the given order. Each time you finish an exercise, perform a commit with a relevant commit description. The exercises will ask you to:
- Create new classes. Each class is in its own file (see Person.java)
- Create methods and attributes
- Use inheritance
- Manipulate data and show results with
System.out.println()
-- The (Main) part of each exercises needs to be done in the main method of the Main class.
- Create a BankAccount class with attributes: accountNumber (String) and balance (double).
- Implement a constructor to initialize the account details.
- Add a deposit(double amount) method to increase the balance.
- Add a withdraw(double amount) method to decrease the balance. Ensure the withdrawal amount is less than the balance.
- (Main) Create an instance of BankAccount and demonstrate deposit and withdrawal operations.
- Extend the BankAccount class to create a SavingsAccount class.
- Add an attribute interestRate (double) to the SavingsAccount class.
- Implement a constructor to initialize the account details and interest rate.
- Override the deposit(double amount) method to add additional interest based on the interest rate.
- (Main) Create an instance of SavingsAccount and demonstrate deposit operations with interest.
- Extend the BankAccount class to create a CheckingAccount class.
- Add an attribute overdraftLimit (double) to the CheckingAccount class.
- Implement a constructor to initialize the account details and overdraft limit.
- Override the withdraw(double amount) method to allow overdraft within the overdraft limit.
- (Main) Create an instance of CheckingAccount and demonstrate withdrawal operations with overdraft.
- Create a BankCustomer class with attributes: name (String) and a collection of BankAccount objects.
- Implement a constructor to initialize the customer's name and accounts.
- Add a addAccount(BankAccount account) method to add accounts to the customer's collection.
- Implement a totalBalance() method to calculate the total balance across all accounts.
- (Main) Create an instance of BankCustomer, add multiple accounts, and display the total balance.
- Extend the BankAccount class to add a transactions list to store transaction history.
- Implement a recordTransaction(String transaction) method to add transactions to the list.
- Add a getTransactionHistory() method to retrieve and display the transaction history.
- Update the deposit and withdrawal methods to record transactions.
- (Main) Demonstrate recording and retrieving transaction history.
- Create a method generateReport() in the BankCustomer class to display a summary of the customer's accounts and balances.
- Override the toString() method in BankAccount, SavingsAccount, and CheckingAccount to display account-specific information.
- (Main) Call the generateReport() method for the customer and display the banking report.
- Implement a method updateInterestRate(double newRate) in the SavingsAccount class to update the interest rate.
- (Main) Demonstrate changing the interest rate and performing deposits to see the updated interest calculation.
- Override the withdraw(double amount) method in the CheckingAccount class to restrict overdraft.
- If the withdrawal amount exceeds the balance + overdraft limit, prevent the withdrawal.
- (Main) Demonstrate the overridden withdrawal method by attempting to withdraw beyond the overdraft limit.