Solved

Assume the Method Below Has Been Added to the BankAccount

Question 79

Multiple Choice

Assume the method below has been added to the BankAccount class. public void transfer (BankAccount source, double amount)
{
Balance = balance + amount;
Source.balance = source.balance - amount;
}
What will be output from the following statements that use the revised BankAccount class?
BankAccount first = new BankAccount (100.0) ;
BankAccount second = new BankAccount (300.0) ;
First.transfer (second, 50.0) ;
System.out.println (first.getBalance() + " "
+ second.getBalance() ) ;


A) 100.0 300.0
B) 150.0 250.0
C) 150.0 300.0
D) 100.0 250.0

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions