From 58e7381c3bb2ba8e77553da11a7312114f7acbf0 Mon Sep 17 00:00:00 2001 From: CodeMyGame1 Date: Sat, 20 Jun 2026 11:40:32 -0700 Subject: [PATCH 1/4] feat: push completed draft of variables and print statements exercises --- stage0/solution/Print.java | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 stage0/solution/Print.java diff --git a/stage0/solution/Print.java b/stage0/solution/Print.java new file mode 100644 index 0000000..691b2d8 --- /dev/null +++ b/stage0/solution/Print.java @@ -0,0 +1,35 @@ +package solution; + +public class Print { + public static void main(String args[]) { + // Print "Hello World!", with a newline at the end. + System.out.println("Hello World!"); + + // Print the following lines, each with a separate `println()` statement: + // The robot knows where it is at all times. + // It knows this because it knows where it isn't. + System.out.println("The robot knows where it is at all times."); + System.out.println("It knows this because it knows where it isn't."); + + // Define a variable `pi` that is equal to 3.14159. + double pi = 3.14159; + // Define a variable `g` that is equal to 10. + int g = 10; + // Define a variable `mode` that is equal to "autonomous". + String mode = "autonomous"; + + // Now, print all three variables in the **same** print statement, + // separated by spaces. + System.out.println(pi + " " + g + " " + mode); + + // Now, change pi to equal 3.142857. Then, print the value of `pi` again. + pi = 3.142857; + System.out.println(pi); + + // Create a variable `degrees` of type `double` and assign it a value of + // 360. Then, print the variable to observe the type narrowing behavior + // (it stores as a double, although an integer was passed to it). + double degrees = 360; + System.out.println(degrees); + } +} \ No newline at end of file From d0e40bf1436a7a661bc35ae53f5da01a7686a482 Mon Sep 17 00:00:00 2001 From: CodeMyGame1 Date: Sat, 20 Jun 2026 11:40:48 -0700 Subject: [PATCH 2/4] feat: push completed draft of operators exercises --- stage0/solution/Operators.java | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 stage0/solution/Operators.java diff --git a/stage0/solution/Operators.java b/stage0/solution/Operators.java new file mode 100644 index 0000000..0d1d9eb --- /dev/null +++ b/stage0/solution/Operators.java @@ -0,0 +1,52 @@ +package solution; + +public class Operators { + public static void main(String[] args) { + // Create two integer variables, `first` and `second`. Assign `first` + // a value of 5, and `second` a value of 4. Then, print the sum of + // `first` and `second`. + int first = 5; + int second = 4; + System.out.println(first + second); + + // Create an integer variable `result`. Multiply the sum of 1 + 6 by the + // difference of 7 and 8, and store it in this variable. Then, print + // the value of `result`. + int result = (1 + 6) * (7 - 8); + System.out.println(result); + + // Given the below variable `rotPerSec`, create a variable `rotPerHour` + // whose value represents the corresponding amount of rotations per + // hour for `rotPerSec`. Then, print the value of `rotPerHour`. + int rotPerSec = 5; + int rotPerHour = rotPerSec * 60 * 60; + System.out.println(rotPerHour); + + // Create an integer variable `quotient1`, and assign to it the value + // of 5 divided by 3. Then print the value of `quotient1`. + double quotient1 = 5 / 3; + System.out.println(quotient1); + + // Create a variable `quotient2` of type double, and assign to it the + // value of 5.0 divided by 3. Then print the value of `quotient2`. + double quotient2 = 5.0 / 3; + System.out.println(quotient2); + + // TODO: Type casting if requested. + + // Print the sum, difference, product, and quotient of the two variables + // below. Especially take note of how the quotient is printed. + int num1 = 15; + int num2 = 2; + System.out.println(num1 + num2); + System.out.println(num1 - num2); + System.out.println(num1 * num2); + System.out.println(num1 / num2); + + // Create a variable `avg` of type double, and assign to it the average + // of the values 2, 5, and 4. Then print the value of `avg`. + // HINT: How can you ensure the result is not improperly rounded? + double avg = (2 + 5 + 4) / 3.0; + System.out.println(avg); + } +} From dd63a71bd83ac07836d16e612f5fe771c35eb361 Mon Sep 17 00:00:00 2001 From: CodeMyGame1 Date: Wed, 8 Jul 2026 16:02:45 -0700 Subject: [PATCH 3/4] chore: migrate java exercises to correct directory --- examples/stage0/solutions/Operators.java | 48 +++++++++++++++++ .../stage0/solutions}/Print.java | 2 - stage0/solution/Operators.java | 52 ------------------- 3 files changed, 48 insertions(+), 54 deletions(-) create mode 100644 examples/stage0/solutions/Operators.java rename {stage0/solution => examples/stage0/solutions}/Print.java (98%) delete mode 100644 stage0/solution/Operators.java diff --git a/examples/stage0/solutions/Operators.java b/examples/stage0/solutions/Operators.java new file mode 100644 index 0000000..d05fb9a --- /dev/null +++ b/examples/stage0/solutions/Operators.java @@ -0,0 +1,48 @@ +void main() { + // Create two integer variables, `first` and `second`. Assign `first` + // a value of 5, and `second` a value of 4. Then, print the sum of + // `first` and `second`. + int first = 5; + int second = 4; + System.out.println(first + second); + + // Create an integer variable `result`. Multiply the sum of 1 + 6 by the + // difference of 7 and 8, and store it in this variable. Then, print + // the value of `result`. + int result = (1 + 6) * (7 - 8); + System.out.println(result); + + // Given the below variable `rotPerSec`, create a variable `rotPerHour` + // whose value represents the corresponding amount of rotations per + // hour for `rotPerSec`. Then, print the value of `rotPerHour`. + int rotPerSec = 5; + int rotPerHour = rotPerSec * 60 * 60; + System.out.println(rotPerHour); + + // Create an integer variable `quotient1`, and assign to it the value + // of 5 divided by 3. Then print the value of `quotient1`. + double quotient1 = 5 / 3; + System.out.println(quotient1); + + // Create a variable `quotient2` of type double, and assign to it the + // value of 5.0 divided by 3. Then print the value of `quotient2`. + double quotient2 = 5.0 / 3; + System.out.println(quotient2); + + // TODO: Type casting if requested. + + // Print the sum, difference, product, and quotient of the two variables + // below. Especially take note of how the quotient is printed. + int num1 = 15; + int num2 = 2; + System.out.println(num1 + num2); + System.out.println(num1 - num2); + System.out.println(num1 * num2); + System.out.println(num1 / num2); + + // Create a variable `avg` of type double, and assign to it the average + // of the values 2, 5, and 4. Then print the value of `avg`. + // HINT: How can you ensure the result is not improperly rounded? + double avg = (2 + 5 + 4) / 3.0; + System.out.println(avg); +} \ No newline at end of file diff --git a/stage0/solution/Print.java b/examples/stage0/solutions/Print.java similarity index 98% rename from stage0/solution/Print.java rename to examples/stage0/solutions/Print.java index 691b2d8..a6670c3 100644 --- a/stage0/solution/Print.java +++ b/examples/stage0/solutions/Print.java @@ -1,5 +1,3 @@ -package solution; - public class Print { public static void main(String args[]) { // Print "Hello World!", with a newline at the end. diff --git a/stage0/solution/Operators.java b/stage0/solution/Operators.java deleted file mode 100644 index 0d1d9eb..0000000 --- a/stage0/solution/Operators.java +++ /dev/null @@ -1,52 +0,0 @@ -package solution; - -public class Operators { - public static void main(String[] args) { - // Create two integer variables, `first` and `second`. Assign `first` - // a value of 5, and `second` a value of 4. Then, print the sum of - // `first` and `second`. - int first = 5; - int second = 4; - System.out.println(first + second); - - // Create an integer variable `result`. Multiply the sum of 1 + 6 by the - // difference of 7 and 8, and store it in this variable. Then, print - // the value of `result`. - int result = (1 + 6) * (7 - 8); - System.out.println(result); - - // Given the below variable `rotPerSec`, create a variable `rotPerHour` - // whose value represents the corresponding amount of rotations per - // hour for `rotPerSec`. Then, print the value of `rotPerHour`. - int rotPerSec = 5; - int rotPerHour = rotPerSec * 60 * 60; - System.out.println(rotPerHour); - - // Create an integer variable `quotient1`, and assign to it the value - // of 5 divided by 3. Then print the value of `quotient1`. - double quotient1 = 5 / 3; - System.out.println(quotient1); - - // Create a variable `quotient2` of type double, and assign to it the - // value of 5.0 divided by 3. Then print the value of `quotient2`. - double quotient2 = 5.0 / 3; - System.out.println(quotient2); - - // TODO: Type casting if requested. - - // Print the sum, difference, product, and quotient of the two variables - // below. Especially take note of how the quotient is printed. - int num1 = 15; - int num2 = 2; - System.out.println(num1 + num2); - System.out.println(num1 - num2); - System.out.println(num1 * num2); - System.out.println(num1 / num2); - - // Create a variable `avg` of type double, and assign to it the average - // of the values 2, 5, and 4. Then print the value of `avg`. - // HINT: How can you ensure the result is not improperly rounded? - double avg = (2 + 5 + 4) / 3.0; - System.out.println(avg); - } -} From 7f233b035914180f3159e2e9913fdf60e4d3b587 Mon Sep 17 00:00:00 2001 From: CodeMyGame1 Date: Wed, 8 Jul 2026 16:29:00 -0700 Subject: [PATCH 4/4] feat: update operators exercises to include more operators --- examples/stage0/solutions/Operators.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/examples/stage0/solutions/Operators.java b/examples/stage0/solutions/Operators.java index d05fb9a..cdcdc0f 100644 --- a/examples/stage0/solutions/Operators.java +++ b/examples/stage0/solutions/Operators.java @@ -28,6 +28,25 @@ void main() { // value of 5.0 divided by 3. Then print the value of `quotient2`. double quotient2 = 5.0 / 3; System.out.println(quotient2); + + // Create a variable `normalizedAngle` that takes `rawEncoderDegrees` + // and calculates its "true" value (as a degree amount from 0 to 360). + // Then print the value of `normalizedAngle`. + int rawEncoderDegrees = 560; + int normalizedAngle = 560 % 360; + System.out.println(normalizedAngle); + + // Using only the increment operator, add 1 to the `timer` variable below. + // Then print the value of `timer`. + int timer = 1000; + timer++; + System.out.println(timer); + + // Using only the decrement operator, subtract 1 from the `secondsLeftInMatch` + // variable below. Then print the value of `secondsLeftInMatch`. + int secondsLeftInMatch = 85; + secondsLeftInMatch--; + System.out.println(secondsLeftInMatch); // TODO: Type casting if requested.