Question: Download the Bank.java driver class file from the class GitHub repository Add a comment at the top of each code file with your name, course

Download the Bank.java driver class file from the class GitHub repository
Add a comment at the top of each code file with your name, course name & section, and todays date (the format for this is up to you, but be clear & consistent)
Create a class called BankAccount (in a separate file from the driver) that represents a bank account that includes the following:
Fields:
The owners name (String)
The account number (int)
The account balance (double)
A static private int accountCount
Constructors:
NOTE: both constructors should assign an account number by adding 1000 to the accountCount fields value, then incrementing accountCount
A constructor with the owners name as a parameter. Set the balance to 0 in the constructor.
A constructor with the owners name & initial balance as parameters.
Methods:
getBalance()is a getter method that returns the balance
deposit(amount)is a setter method that adds amount to the balance
withdraw(amount)is a setter method that subtracts amount from the balance
Other getter/setter methods as you see fit (think about what things can or cannot change in a bank account)
getAccountCount() returns the number of accounts that have been created
toString() returns the owners name, account number, and balance as a String
Create a driver class that does the following:
Create 3 bank accounts with the following balances:10000,0, & 500
Display the 3 bank accounts using your toString method
Deposit 500 in account 1
Deposit 7500 in account 2
Withdraw 100 from account 3
Withdraw 2000 from account 1
Deposit 1000 in account 2
Display the 3 bank accounts again after the withdrawals & deposits

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!