0%
0 / 15 answered
Documentation with Comments Practice Test
•15 QuestionsQuestion
1 / 15
Q1
public class Wallet { private double balance;
/**
* Adds money to the wallet.
* Precondition: amount > 0
* Postcondition: balance is increased by amount.
*/
public void addMoney(double amount)
{
balance = amount;
}
// ... constructor not shown
}
The implementation of the addMoney method is incorrect because it does not meet its postcondition. Why?
The implementation of the addMoney method is incorrect because it does not meet its postcondition. Why?