Question: The following task needs to be written in java using repl.it Create a new class called BankAccount.java and have it contain the following: ~Data Fields:
The following task needs to be written in java using repl.it
Create a new class called BankAccount.java and have it contain the following:
~Data Fields:
*The owner's name
*Balance (how much money is in the account)
~Constructor:
*A custom constructor that takes in the owner's name and balance
~Methods:
*A getter for name
*A getter for balance
*A deposit method to allow the owner to add additional funds
*A withdraw method to allow the user to take out money (if there is enough). Do not allow the user to withdraw more money than the current balance
*a toString() method to display the owner's name and account balance.
Part Two:
Write a driver that:
*Instantiates a new bank account
*Displays the initial name and balance
*Deposits funds
*Displays the name and new balance
*Withdraws funds (use a "legal" withdraw amount)
*Displays the name and new balance
Can someone please help me write the code for this. I really need help.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
