Hello,

Any help on the following problem would be greatly appreciated.
The assignment is done with .java in eclipse. I have a class and a form with a Jlist, 2 text fields to enter the check amount and the ending Balance and a calulate button. I have some aspects working, but am having some trouble, such as how to get the fee amount to show (repaint?) into the jList.

A bank charges $10 per month plus the following check fees for a commercial checking account:
.10 for each check if less than 20 checks were written
.08 of 20 - 39 checks were written
.06 for each check if 40-59 were written
.04 for each check if 60 or more were written

The bank also charges an extra $15 if the account balance falls below $400 (before any check fees are applied). Design a class that stores the ending balance of an account and the number of checks written. It should have a method that returns the banks service fees for the month.

To solve this problem and display the fee amount in the JList, you need to implement the following steps:

1. Create a class called "BankAccount" that stores the ending balance of an account and the number of checks written. The class should have instance variables to store these values.

2. Add a constructor to the "BankAccount" class that initializes the ending balance and number of checks written.

3. Implement a method in the "BankAccount" class called "getServiceFees" that calculates and returns the bank's service fees for the month based on the number of checks written and the ending balance.

- Inside the "getServiceFees" method, you can use conditional statements (if-else or switch-case) to determine the service fees based on the number of checks.
- Use the formula given in the problem statement to calculate the fees.
- Store the fee amount in a variable, let's call it "feeAmount".

4. In your main program, create an instance of the "BankAccount" class and implement the necessary event handling for the "calculate" button.

- When the "calculate" button is clicked or pressed, extract the values entered in the text fields for the check amount and ending balance.
- Convert the extracted values to appropriate data types (e.g., double).
- Update the instance of the "BankAccount" class with the extracted values.
- Call the "getServiceFees" method on the instance to get the fee amount.
- Use a ListModel or DefaultListModel to store the fee amounts and update the JList by adding the fee amount to the model.
- Repaint or refresh the JList to display the updated fee amounts.

5. Finally, run the program in Eclipse and test it by entering different check amounts and ending balances. Observe the results in the JList.

Remember to handle any exceptions that might occur, such as if the input values in the text fields are not valid numbers.

I hope this helps you solve the problem and implement the required functionality. Let me know if you have any further questions!

To solve this problem, you can follow these steps:

Step 1: Create a class called "CheckingAccount" with the necessary instance variables and methods.

Step 2: In the "CheckingAccount" class, create instance variables to store the ending balance and the number of checks written. Also, create a constant variable to represent the minimum balance of $400.

Step 3: Implement a constructor in the "CheckingAccount" class that takes the ending balance as a parameter and initializes the instance variables.

Step 4: Implement a method in the "CheckingAccount" class to calculate the bank's service fees for the month, based on the number of checks written.

- Create a local variable called "fee" to store the service fees amount.
- Use conditional statements to determine the fee amount based on the number of checks written.
- Update the fee amount if the balance falls below $400, by adding $15 to the fee.
- Return the fee amount.

Step 5: In your main class or form, create an instance of the "CheckingAccount" class.

Step 6: Handle the button click event or ActionListener for the calculate button.

- Retrieve the check amount and ending balance entered by the user from the text fields.
- Convert the check amount to an integer or double data type.
- Set the check amount and ending balance in the instance of the "CheckingAccount" class.
- Call the method to calculate the service fees.
- Add the fee amount to the JList to display it.

Step 7: Repaint or refresh the JList to display the updated fee amount.

That's it! Following these steps should help you implement the required functionality for your assignment.