From 6c2bf723e8af74b2ac57464fbe6d2c7fb191e8fe Mon Sep 17 00:00:00 2001 From: Adriana <16786568+Adrianamm@users.noreply.github.com> Date: Tue, 15 Sep 2026 22:35:02 -0400 Subject: [PATCH 1/7] Create loops.java --- examples/stage0/solutions/src/loops.java | 56 ++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 examples/stage0/solutions/src/loops.java diff --git a/examples/stage0/solutions/src/loops.java b/examples/stage0/solutions/src/loops.java new file mode 100644 index 00000000..dadf2753 --- /dev/null +++ b/examples/stage0/solutions/src/loops.java @@ -0,0 +1,56 @@ +/* + * Copyright 2026 FRCSoftware + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +class Drivetrain { + /** + * Dummy function that spins drivetrain motors at the specified speed. + * @param speed + */ + public void setThrottle(double speed) { + String throttleInfo = String.format("Spinning drivetrain motors at speed: %d", speed); + System.out.println(throttleInfo); + } +} +Drivetrain drivetrain = new Drivetrain(); + +void main() { + + // First, a new integer variable named `error` + // Below, create a while loop that compares if error is less than 5 + // if that is true, print "Robots should not quit", then increase `error` by one + // if error is no longer less than 5, print "but yours did" + int error = 0; + while (error < 5){ + System.out.println("Robots should not quit"); + error++; + } + System.out.println("but yours did"); + + // Create a for loop that has a new integer variable named `timer` + // that is set to 15. Check for when timer is greater than or equal to 0, + // then decrease timer by one. + // Inside the for loop, include a print statement that prints "time left " + // and the variable `timer` + for (int timer = 15; timer >= 0; timer--){ + System.out.print("time left" + timer); + } + + // First, create a for loop that has a new integer variable named + // `timer` that is set to 15. The for loop checks if `timer` is + // greater than or equal to 0 then it decreases timer by one + // Inside the for loop, have an if statement that checks if timer + // is less than or equal to 0. If so, set the drivetrain speed to 0 + // If the timer is less than or equal to 15, set the speed to one + for (int timer = 15; timer >= 0; timer--){ + if (timer <= 0 ){ + drivetrain.setThrottle(0); + + } else if (timer <= 15 ){ + drivetrain.setThrottle(1); + } + } + +} From ba0c1857b3d9618bf6756a32eb88b472f306152b Mon Sep 17 00:00:00 2001 From: Adriana <16786568+Adrianamm@users.noreply.github.com> Date: Tue, 15 Sep 2026 22:40:19 -0400 Subject: [PATCH 2/7] aa --- examples/stage0/templates/src/loops.java | 49 ++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 examples/stage0/templates/src/loops.java diff --git a/examples/stage0/templates/src/loops.java b/examples/stage0/templates/src/loops.java new file mode 100644 index 00000000..f9788fae --- /dev/null +++ b/examples/stage0/templates/src/loops.java @@ -0,0 +1,49 @@ +/* + * Copyright 2026 FRCSoftware + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +class Drivetrain { + /** + * Dummy function that spins drivetrain motors at the specified speed. + * @param speed + */ + public void setThrottle(double speed) { + String throttleInfo = String.format("Spinning drivetrain motors at speed: %d", speed); + System.out.println(throttleInfo); + } +} +Drivetrain drivetrain = new Drivetrain(); + +void main() { + + // First, a new integer variable named `error` + // Below, create a while loop that compares if error is less than 5 + // if that is true, print "Robots should not quit", then increase `error` by one + // if error is no longer less than 5, print "but yours did" + + + + + + + // Create a for loop that has a new integer variable named `timer` + // that is set to 15. Check for when timer is greater than or equal to 0, + // then decrease timer by one. + // Inside the for loop, include a print statement that prints "time left " + // and the variable `timer` + + + + + + // First, create a for loop that has a new integer variable named + // `timer` that is set to 15. The for loop checks if `timer` is + // greater than or equal to 0 then it decreases timer by one + // Inside the for loop, have an if statement that checks if timer + // is less than or equal to 0. If so, set the drivetrain speed to 0 + // If the timer is less than or equal to 15, set the speed to one + + +} From 9285a0301f8dffa17acc6242e544280052a1f36e Mon Sep 17 00:00:00 2001 From: Adriana <16786568+Adrianamm@users.noreply.github.com> Date: Tue, 15 Sep 2026 23:16:59 -0400 Subject: [PATCH 3/7] Apply batched suggestions from code review Co-authored-by: Spaceman 11 <135277197+Spaceman113138@users.noreply.github.com> --- examples/stage0/solutions/src/loops.java | 4 ++-- examples/stage0/templates/src/loops.java | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/stage0/solutions/src/loops.java b/examples/stage0/solutions/src/loops.java index dadf2753..f89735d7 100644 --- a/examples/stage0/solutions/src/loops.java +++ b/examples/stage0/solutions/src/loops.java @@ -32,10 +32,10 @@ void main() { // Create a for loop that has a new integer variable named `timer` // that is set to 15. Check for when timer is greater than or equal to 0, // then decrease timer by one. - // Inside the for loop, include a print statement that prints "time left " + // Inside the for loop, include a print statement that prints "time left: " // and the variable `timer` for (int timer = 15; timer >= 0; timer--){ - System.out.print("time left" + timer); + System.out.println("time left: " + timer); } // First, create a for loop that has a new integer variable named diff --git a/examples/stage0/templates/src/loops.java b/examples/stage0/templates/src/loops.java index f9788fae..4b2434ce 100644 --- a/examples/stage0/templates/src/loops.java +++ b/examples/stage0/templates/src/loops.java @@ -10,8 +10,7 @@ class Drivetrain { * @param speed */ public void setThrottle(double speed) { - String throttleInfo = String.format("Spinning drivetrain motors at speed: %d", speed); - System.out.println(throttleInfo); + System.out.println("Spinning drivetrain motors at speed: " + throttleInfo); } } Drivetrain drivetrain = new Drivetrain(); From 2689abcbe6e8d264818b3d483d10f1eb72928453 Mon Sep 17 00:00:00 2001 From: Adriana <16786568+Adrianamm@users.noreply.github.com> Date: Wed, 16 Sep 2026 00:32:08 -0400 Subject: [PATCH 4/7] Update examples/stage0/templates/src/loops.java Co-authored-by: Spaceman 11 <135277197+Spaceman113138@users.noreply.github.com> --- examples/stage0/templates/src/loops.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/stage0/templates/src/loops.java b/examples/stage0/templates/src/loops.java index 4b2434ce..dbbd3ac6 100644 --- a/examples/stage0/templates/src/loops.java +++ b/examples/stage0/templates/src/loops.java @@ -10,7 +10,7 @@ class Drivetrain { * @param speed */ public void setThrottle(double speed) { - System.out.println("Spinning drivetrain motors at speed: " + throttleInfo); + System.out.println("Spinning drivetrain motors at speed: " + speed); } } Drivetrain drivetrain = new Drivetrain(); From df3f45969cd86fb6274c0bd2db3da5d4baf0f066 Mon Sep 17 00:00:00 2001 From: Adriana <16786568+Adrianamm@users.noreply.github.com> Date: Wed, 16 Sep 2026 00:37:08 -0400 Subject: [PATCH 5/7] Apply batched suggestions from code review Co-authored-by: Spaceman 11 <135277197+Spaceman113138@users.noreply.github.com> --- examples/stage0/solutions/src/loops.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/stage0/solutions/src/loops.java b/examples/stage0/solutions/src/loops.java index f89735d7..fe863655 100644 --- a/examples/stage0/solutions/src/loops.java +++ b/examples/stage0/solutions/src/loops.java @@ -10,8 +10,7 @@ class Drivetrain { * @param speed */ public void setThrottle(double speed) { - String throttleInfo = String.format("Spinning drivetrain motors at speed: %d", speed); - System.out.println(throttleInfo); + System.out.println("Spinning drivetrain motors at speed: " + speed)); } } Drivetrain drivetrain = new Drivetrain(); From 507e1005303fd1d790bf77d0046149ef3f8d636b Mon Sep 17 00:00:00 2001 From: Adriana <16786568+Adrianamm@users.noreply.github.com> Date: Wed, 16 Sep 2026 00:40:30 -0400 Subject: [PATCH 6/7] Update loops.java --- examples/stage0/solutions/src/loops.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/stage0/solutions/src/loops.java b/examples/stage0/solutions/src/loops.java index fe863655..3d29ff6a 100644 --- a/examples/stage0/solutions/src/loops.java +++ b/examples/stage0/solutions/src/loops.java @@ -10,7 +10,7 @@ class Drivetrain { * @param speed */ public void setThrottle(double speed) { - System.out.println("Spinning drivetrain motors at speed: " + speed)); + System.out.println("Spinning drivetrain motors at speed: " + speed); } } Drivetrain drivetrain = new Drivetrain(); From 038c2e9f29eb4783fd7762e58a20d8c0118f1b7f Mon Sep 17 00:00:00 2001 From: Adriana <16786568+Adrianamm@users.noreply.github.com> Date: Wed, 16 Sep 2026 16:06:09 -0400 Subject: [PATCH 7/7] Apply batched suggestions from code review Co-authored-by: Sam Freund --- examples/stage0/solutions/src/loops.java | 2 +- examples/stage0/templates/src/loops.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/stage0/solutions/src/loops.java b/examples/stage0/solutions/src/loops.java index 3d29ff6a..c2ce123f 100644 --- a/examples/stage0/solutions/src/loops.java +++ b/examples/stage0/solutions/src/loops.java @@ -17,7 +17,7 @@ public void setThrottle(double speed) { void main() { - // First, a new integer variable named `error` + // First, create a new integer variable named `error` // Below, create a while loop that compares if error is less than 5 // if that is true, print "Robots should not quit", then increase `error` by one // if error is no longer less than 5, print "but yours did" diff --git a/examples/stage0/templates/src/loops.java b/examples/stage0/templates/src/loops.java index dbbd3ac6..711d4290 100644 --- a/examples/stage0/templates/src/loops.java +++ b/examples/stage0/templates/src/loops.java @@ -17,7 +17,7 @@ public void setThrottle(double speed) { void main() { - // First, a new integer variable named `error` + // First, create a new integer variable named `error` // Below, create a while loop that compares if error is less than 5 // if that is true, print "Robots should not quit", then increase `error` by one // if error is no longer less than 5, print "but yours did"