Skip to content

Stage 0: Add Java fundamentals exercises - #81

Draft
CodeMyGame1 wants to merge 8 commits into
frcsoftware:mainfrom
CodeMyGame1:stage0-exercises
Draft

Stage 0: Add Java fundamentals exercises#81
CodeMyGame1 wants to merge 8 commits into
frcsoftware:mainfrom
CodeMyGame1:stage0-exercises

Conversation

@CodeMyGame1

@CodeMyGame1 CodeMyGame1 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Description

Adds exercises for stage 0 (Java Fundamentals), to complement the stage 0 lessons being built up.

Meta

Merge checklist:

Comment thread stage0/solution/Operators.java Outdated

// 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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In 2027, WPILib has a compiler plugin that will throw a compile-time error if someone tries to do this.

So, make it an int instead (and let people know that regular java doesn't error when you do integer division like this).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though it will throw an error, I still think it's valuable to showcase what happens here to better explain why there's an error and why it's problematic. Plus, I don't want to include something that's wrong in normal java, even if wpilib makes it not wrong, in a way.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean converting quotient1 to an int is wrong, or that keeping it as a double is wrong in normal Java?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant keeping it as a double, my bad.

My main concern is that this code doesn't pass CI (also, y'all got it backwards: it's wrong in WPILib java, but not in normal java).

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

🌐 Preview URL: https://pr-81.frcsoftware.pages.dev

@@ -0,0 +1,54 @@
void main() {
// Using the variable `turretEnabled` below, decide whether to turn on

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment mentioned turretEnabled, but code has shooterEnabled

}
System.out.println(turretVelocity);

// Using only the NOT EQUALS TO operator, and the variable `statusCode` below,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the operator name is just NOT EQUALS

Comment on lines +9 to +11
// 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`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Using java math operators, multiply...'


// 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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int?

Comment on lines +19 to +21
// Now, print all three variables in the **same** print statement,
// separated by spaces.
System.out.println(pi + " " + g + " " + mode);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any lessons on string formatting?

@Adrianamm
Adrianamm self-requested a review August 13, 2026 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants