Problem

a. Create a class named BankAccount with fields that hold an account number, the owner’s...

a. Create a class named BankAccount with fields that hold an account number, the owner’s name, and the account balance. Include a constructor that initializes each field to appropriate default values. Also include methods to get and set each of the fields. Include a method named deductMonthlyFee() that reduces the balance by $4.00. Include a static method named explainAccountPolicy() that explains that the $4 service fee will be deducted each month. Save the class as BankAccount.java.

b. Create a class named TestBankAccount whose main() method declares four BankAccount objects. Call a getData() method three times. Within the method, prompt a user for values for each field for a BankAccount, and return a BankAccount object to the main() method where it is assigned to one of main()’s BankAccount objects. Do not prompt the user for values for the fourth BankAccount object, but let it continue to hold the default values. Then, in main(), pass each BankAccount object in turn to a showValues() method that displays the data, calls the method that deducts the monthly fee, and displays the balance again. The showValues() method also calls the method that explains the deduction policy. Save the application as TestBankAccount.java.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT