Requirements summary:

1) Develop a Java GUI application that reads account information from a provided text file (list.txt), shows all account numbers in a JComboBox, and displays other GUI controls as shown;

2) Exit button : Quit the application;

3) Deposit button: Make a deposit to a selected account;

4) Withdraw button Make a withdrawal from a selected account;

5) Transfer To button: Make a transfer from a selected account to a beneficiary account.

Bank account application: See image.

Requirements details:

GUI in general

Once the program starts, it reads all account information from list.txt (each row in the file is an account record and is in the format of

accountNumber< >customerName< >openDate< >balance

where < > is the partition/delimiter between two fields. The openDate is in the format of year/month/date.) It then displays all account numbers in a JComboBox and shows other GUI controls as in the first figure.

When you select an item (account number) from the JComboBox, the corresponding values for openDate, customerName, and balance will be shown in the three read-only text fields, and the Deposit, Withdraw, and Transfer To buttons becomes enabled, see Fig. 2. See image.

Exit

Clicking this button to close the frame and exit the program.

Instead of using mouse to click the button, pressing Alt + x will also trigger the Exit button. Refer Java API and use setMnemonic() method for this feature.

Deposit

(After selecting an account from the JComboBox), clicking the Deposit button will popup a window as shown in Fig. 3 asking you to enter a deposit amount for the selected account. Hint: refer to JOptionPane.showInputDialog() method for how to create an input dialog like the Fig. 3. See image.

If you enter a non-negative number, such as 100, the amount will be deposited to the account.

See Fig 4: the balanced is adjusted accordingly (from $46.10 to $146.10). The list.txt file should also be updated accordingly as well. See image.

If you clicking Cancel in Fig. 3, the deposit will not occur.

If an invalid deposit amount is entered, such as -100 or $100, you will see an error message as shown in Fig 5. See image.

Withdraw

(After selecting an account from the JComboBox), clicking the Withdraw button will popup a window as shown in Fig. 6 asking you to enter a withdrawal amount for the selected account. See image.

After you enter a non-negative number, such as 100, and if the balance is sufficient, the withdrawal will be made from the account successfully. See Fig. 7, the balanced is adjusted (from $146.10 to $46.10). The list.txt file should also be updated accordingly as well. See image.

If you clicking Cancel in Fig. 6, the withdrawal will not occur.

If an invalid withdrawal amount is entered, such as -100 or $100, you will see an error message as shown in Fig 8. See image.

Transfer To

(After selecting an account from the JComboBox), clicking the Transfer To button will popup a window as shown in Fig. 10 asking you to enter a beneficiary account number. See image.

If a valid account number (any number existing in the JComboBox) is entered, after click OK button, a window like Fig. 11 pops up asking for amount to transfer. See image.

If a valid amount is entered, and the balance is not less than the amount and sometimes the sum of the amount and a transfer fee, the transfer will be succeeded as shown in Fig. 12 and 13. Transfer fee is only applied to account with the balance less than $10000 which is specified in AccountConstants interface (more about AccountConstants see end of this document). See image. See figure 13 image.

If an invalid beneficiary account number (which does not exist in the JComboBox) is entered in Fig. 10, Fig. 14 shows the error message. See image.

If balance is not sufficient for the transfer amount, Fig. 15 shows the error message. See image.

If balance is not sufficient for the transfer amount and transfer fee (when such a fee applies), Fig. 16 shows the error message. See image.

Design requirements:

You must have at least the following five classes:

AccountConstants contains two constants, CHECKING_BALANCE_THRESHOLD (value is 10000) and TRANSFER_FEE (value is 2.0). For this project, the business rule is as follows:

When making a transfer to a beneficiary account, if the balance of the transferring account is less than CHECKING_BALANCE_THRESHOLD, TRANSFER_FEE is deducted from the balance after the transfer is made. If the balance is not sufficient to cover both CHECKING_BALANCE_THRESHOLD and TRANSFER_FEE (if the fee applies), the transfer should not be made. If the balance of transferring account is not less than CHECKING_BALANCE_THRESHOLD, TRANSFER_FEE is waived for a transfer.

Account transferTo method in Account is abstract. deposit() and withdraw() are not abstract. If you need, feel free to define other methods, such as getBalance(), in the Account class. See image.

CheckingAccount: extends Account and implements transferTo method. The returned value of transferTo method is defined as follows.

  • return 0: transfer successful and without transfer fee
  • return 1: transfer successful and with transfer fee applied
  • return -1: transfer unsuccessful because balance is less than transfer amount and transfer fee
  • return -2: transfer unsuccessful because balance is less than transfer amount

AccountUtility reads list.txt file, updates the file, and provides data for other programs.

AccountApp is the only Java program having the main method.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.