Stage 0: Methods and Mutable State - #301
Open
httphypixelnet wants to merge 2 commits into
Open
httphypixelnet wants to merge 2 commits into
httphypixelnet wants to merge 2 commits into
Conversation
|
🌐 Preview URL: https://pr-301-frcsoftware.frcsoftware.workers.dev |
EdanThomton
suggested changes
Sep 18, 2026
EdanThomton
left a comment
Contributor
There was a problem hiding this comment.
A few formatting/writing inconsistencies, but otherwise looks good to me
| ScoreKeeper blueAlliance = new ScoreKeeper(30); | ||
|
|
||
| // Print the result of `redAlliance.hasWon(blueAlliance.getScore())`. | ||
| // Since redAlliance's score is currently 0, this should print `false`. |
Contributor
There was a problem hiding this comment.
Suggested change
| // Since redAlliance's score is currently 0, this should print `false`. | |
| // Since `redAlliance`'s score is currently 0, this should print `false`. |
|
|
||
| // Print the result of `redAlliance.hasWon(blueAlliance.getScore())`. | ||
| // Since redAlliance's score is currently 0, this should print `false`. | ||
| // After running, change blueAlliance's starting score to `-5`; the code |
Contributor
There was a problem hiding this comment.
Suggested change
| // After running, change blueAlliance's starting score to `-5`; the code | |
| // After running, change `blueAlliance`'s starting score to `-5`; the code |
| System.out.println(redAlliance.hasWon(blueAlliance.getScore())); | ||
|
|
||
| // Call `redAlliance.reset()`, then print `redAlliance.getScore()` again. | ||
| // It should now print `0`, even though redAlliance never had any |
Contributor
There was a problem hiding this comment.
Suggested change
| // It should now print `0`, even though redAlliance never had any | |
| // It should now print `0`, even though `redAlliance` never had any |
|
|
||
|
|
||
| // Print the result of `redAlliance.hasWon(blueAlliance.getScore())`. | ||
| // Since redAlliance's score is currently 0, this should print `false`. |
Contributor
There was a problem hiding this comment.
Suggested change
| // Since redAlliance's score is currently 0, this should print `false`. | |
| // Since `redAlliance`'s score is currently 0, this should print `false`. |
|
|
||
| // Print the result of `redAlliance.hasWon(blueAlliance.getScore())`. | ||
| // Since redAlliance's score is currently 0, this should print `false`. | ||
| // After running, change blueAlliance's starting score to `-5`; the code |
Contributor
There was a problem hiding this comment.
Suggested change
| // After running, change blueAlliance's starting score to `-5`; the code | |
| // After running, change `blueAlliance`'s starting score to `-5`; the code |
| // `System.out.println(redAlliance.getScore());` | ||
| System.out.println(redAlliance.getScore()); | ||
|
|
||
| // Call `redAlliance.applyPenalty(20)`. Since 56 - 20 = 36 is still at |
Contributor
There was a problem hiding this comment.
Suggested change
| // Call `redAlliance.applyPenalty(20)`. Since 56 - 20 = 36 is still at | |
| // Call `redAlliance.applyPenalty(20)`. Since 56 - 20 equals 36, it is still above |
| System.out.println(redAlliance.getScore()); | ||
|
|
||
| // Call `redAlliance.applyPenalty(20)`. Since 56 - 20 = 36 is still at | ||
| // least `MIN_SCORE`, this should print "Penalty applied. Score is now: 36". |
Contributor
There was a problem hiding this comment.
Suggested change
| // least `MIN_SCORE`, this should print "Penalty applied. Score is now: 36". | |
| // or equal to `MIN_SCORE`, this should print "Penalty applied. Score is now: 36". |
|
|
||
| void main() { | ||
| // Create a ScoreKeeper named `redAlliance` using the no-argument | ||
| // constructor. Its score should start at 0. |
Contributor
There was a problem hiding this comment.
Suggested change
| // constructor. Its score should start at 0. | |
| // constructor. Its score should start at `0`. |
| // `System.out.println(redAlliance.getScore());` | ||
|
|
||
|
|
||
| // Call `redAlliance.applyPenalty(20)`. Since 56 - 20 = 36 is still at |
Contributor
There was a problem hiding this comment.
Suggested change
| // Call `redAlliance.applyPenalty(20)`. Since 56 - 20 = 36 is still at | |
| // Call `redAlliance.applyPenalty(20)`. Since 56 - 20 equals 36, it is still above |
|
|
||
|
|
||
| // Call `redAlliance.applyPenalty(20)`. Since 56 - 20 = 36 is still at | ||
| // least `MIN_SCORE`, this should print "Penalty applied. Score is now: 36". |
Contributor
There was a problem hiding this comment.
Suggested change
| // least `MIN_SCORE`, this should print "Penalty applied. Score is now: 36". | |
| // or equal to `MIN_SCORE`, this should print "Penalty applied. Score is now: 36". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Added source files for using methods and interacting with mutable state in Java
Meta
Closes #287
Merge checklist: