Java Quiz
10 questions · no time limit
0:00
SOFTWARE CRAFT AND COMMUNICATION
Question 1 of 10
No time limit
Current
Answered
Flagged
Not seen
PASSAGE
A class stores a monetary balance in a Java int. Its class invariant is balance >= 0. The method contract for deposit(int amount) requires amount > 0 and ensures that the new balance equals the old balance plus amount. No overflow behavior is intended.
Which additional precondition is necessary and sufficient to ensure that an implementation using balance += amount can satisfy the contract without integer overflow?
YOUR PROGRESS
10
QUESTIONS
Ready when you are
Answer in any order. Your progress shows here as you go.
QUESTIONS
KEYBOARD
Pick an answer ABCD
Next question ↵→
Previous ←
Flag for review F