Problem

Suppose the following BankAccount class has been created:1 // Each BankAccount object repr...

Suppose the following BankAccount class has been created:

1	// Each BankAccount object represents one user's account2	// information including name and balance of money.3	public class BankAccount {4		String name;5		double balance;67		public void deposit (double amount) {8			balance = balance + amount;9		}1011		public void withdraw (double amount) {12			balance = balance − amount;13		}14	}

Add a field to the BankAccount class named transactionFee for a real number representing an amount of money to deduct every time the user withdraws money. The default value is $0.00, but the client can change the value. Deduct the transaction fee money during every withdraw call (but not from deposits). Make sure that the balance cannot go negative during a withdrawal. If the withdrawal (amount plus transaction fee) would cause it to become negative, don’t modify the balance at all.

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
Solutions For Problems in Chapter 8
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