🐞 Bug Tracker
Branch order
String comparison
Impossible &&
SummitClearance.java Java 17 -- bug lines become editable after you write a prediction
Variables
1
Lines 5-7
Before reading any conditions -- look only at the variable names and values. What do you think this program is trying to decide? Predict what the final output will be.
Hiker rating check (Bug 1)
2
Lines 9-15
Read the if/else if/else chain carefully. For hikerRating = 10, which branch actually runs? Now look at the branch that did NOT run -- under what value of hikerRating could it ever run? What does that tell you about the code?
⛺ Found a bug? Fix the if/else if order in the code panel.
String comparison (Bug 2)
3
Line 17
if (trailName == "Avalanche Peak") -- what does == actually check in Java? Is it the right tool for comparing Strings? Why or why not?
⛺ Found a bug? Fix line 17 in the code panel.
Weather status check (Bug 3)
4
Line 23
weatherStatus.equals("Clear") && weatherStatus.equals("Stormy") -- evaluate both sides for weatherStatus = "Clear". Can this condition ever be true for any value of weatherStatus? Why or why not?
⛺ Found a bug? Fix line 23 in the code panel.
Full program trace
5
Full program
Write out the complete output of this program exactly as it runs with all bugs fixed. One line per printed statement.