Question: Write a class called BankAccount. The class must have 3 attributes: accountNo(int), holderName(String) and balance(double). a) Class constructor will have to set these 3
Write a class called BankAccount. The class must have 3 attributes: accountNo(int), holderName(String) and balance(double). a) Class constructor will have to set these 3 attributes. b) Create a balanceChange(double amount) method to reduce balance value by given amount. c) In the Main method: 1. Create 4 objects (a1, a2, a3, a4) from this class and add them all to an ArrayList called myAccounts. List will only accept BankAccount type. 2. Sort objects by holderName in the list. (Hint: implement Comparable interface) 3. Reduce the balances by 500 for all the accounts and print sorted objects in the list.
Step by Step Solution
There are 3 Steps involved in it
Certainly To fulfill the instructions from the question we need to write a Java program Lets go through the assignment step by step Step 1 Create the ... View full answer
Get step-by-step solutions from verified subject matter experts
