This website allows you to simulate bank account management. You can create a new bank account, perform actions like depositing or withdrawing money, and check the account balance.
-
Create an Account:
- Fill in the "Account Holder" field with your name.
- Enter the initial balance in the "Initial Balance" field (e.g., 1000).
- Choose the account type (Checking or Savings) from the dropdown.
- Click the "Create Account" button.
-
Perform Actions:
- After creating an account, you can perform three actions: Deposit, Withdraw, or Check Balance.
- Select your desired action from the dropdown.
- Enter the amount (e.g., 500) in the "Amount" field.
- Click the "Submit" button.
-
View Results:
- The result of your action will be displayed under the "Action Result" section.
- If you choose "Check Balance," your account details will also be updated.
- We've defined a
BankAccount
class to represent a bank account. It has properties for the account holder, balance, and account type. Thedeposit
andwithdraw
methods allow you to modify the balance.
- We use a switch statement to determine the action chosen by the user (Deposit, Withdraw, or Check Balance) and execute the corresponding logic.
- Exception handling is implemented using try-catch-finally statements. If an action results in an error (e.g., insufficient funds), the error message is caught and displayed to the user. The finally block ensures proper cleanup.
- We've styled the website using CSS, making it visually appealing and user-friendly. The use of flexbox helps arrange elements neatly.
This website provides a simple and interactive way to manage a bank account while demonstrating the use of JavaScript classes, switch statements, and try-catch-finally statements for error