Beginner Java Programming: Difference between revisions

From TrcWiki
Jump to navigation Jump to search
(Created blank page)
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== TRC Beginner Programming Curriculum ==


=== Class 1 ===
* Introduction, overview: Everyone should bring a laptop to class. Student laptops are ok.
* Set up [replit.com](https://replit.com/signup) accounts: Most students use their google account to sign in.
* Create first java replit, ''Hello World''
** Click ''run'' and get output.
** Discuss the basic components of a java program.
** Explain the syntax.
** Show a couple examples where the program breaks because of bad syntax. Explain the error messages.
* Topics covered:
** Variables
** Primitive types and Expressions
** Introduction to numeric types: ''int, long, float, double''.
** Numeric operators: ''+-*/%''
** Useful constants like ''Math.PI''
** Variable declarations and initialization
** String types: simple string creation, concatenation
** Introduction to ''boolean'' types and operators. ''&& || == !=, >, <'' etc.
** Some practice with these types- give a few simple programming problems
=== Class 2 ===
* Recap ''boolean'' expressions
* Introduction to ''while'' loops
** Using a variable to count loops
** Simple programs using ''while()''
*** Print the numbers 1 to 10
*** Print the numbers 10 to 1
** Incrementing, decrementing,
* Introduction to ''if/else'' statements
** Simple conditional execution
** Combine ''if'' with ''while''. For example, print even numbers up to 20.
* Introduction to ''Scanner'' and ''Random''. 
** Ask the user to input their name and repeat it back
** Ask for a number and repeat back its square
With these two we can start to build a complex program: play a guessing game: choose a random number between 1 and 10 and have the user guess the number, giving too low/ too high feedback. This might require step-by step building up the program with the students.
Assign the ''fizz buzz'' problem for homework.
=== Class 3 ===
* ''Fizz buzz'' solution
* [SKIP] ''do {…} while'' ⇔ ''while''
* Introduction to ''for'' loops
** do several examples
** ''while'' ⇔ ''for'' loop
* Objects and classes: usually we use a working example of Robots or Animals
** Member variables
** Constructors
** Member methods
** Getters/setters
** Static class methods
** Inheritance - show some examples from FRC repos.
* Arrays
** Initialization
** Iterating
** Exercises: find the min, find the max, compute the average
* Case statements
* State machines
** Soda vending machine
** State transition diagram
** What variables are needed,
** Implementation as a class
* Exceptions - throwing/handling
* Wrap-up:
** Tour of FRC code base.
** Examples of state machines, inheritance
** Show example of a shooting state machine from the code.
* Installing '''WPILib''', '''GitHub Desktop'''

Latest revision as of 11:13, 6 July 2024

TRC Beginner Programming Curriculum

Class 1

  • Introduction, overview: Everyone should bring a laptop to class. Student laptops are ok.
  • Set up [replit.com](https://replit.com/signup) accounts: Most students use their google account to sign in.
  • Create first java replit, Hello World
    • Click run and get output.
    • Discuss the basic components of a java program.
    • Explain the syntax.
    • Show a couple examples where the program breaks because of bad syntax. Explain the error messages.
  • Topics covered:
    • Variables
    • Primitive types and Expressions
    • Introduction to numeric types: int, long, float, double.
    • Numeric operators: +-*/%
    • Useful constants like Math.PI
    • Variable declarations and initialization
    • String types: simple string creation, concatenation
    • Introduction to boolean types and operators. && || == !=, >, < etc.
    • Some practice with these types- give a few simple programming problems

Class 2

  • Recap boolean expressions
  • Introduction to while loops
    • Using a variable to count loops
    • Simple programs using while()
      • Print the numbers 1 to 10
      • Print the numbers 10 to 1
    • Incrementing, decrementing,
  • Introduction to if/else statements
    • Simple conditional execution
    • Combine if with while. For example, print even numbers up to 20.
  • Introduction to Scanner and Random.
    • Ask the user to input their name and repeat it back
    • Ask for a number and repeat back its square

With these two we can start to build a complex program: play a guessing game: choose a random number between 1 and 10 and have the user guess the number, giving too low/ too high feedback. This might require step-by step building up the program with the students.

Assign the fizz buzz problem for homework.

Class 3

  • Fizz buzz solution
  • [SKIP] do {…} whilewhile
  • Introduction to for loops
    • do several examples
    • whilefor loop
  • Objects and classes: usually we use a working example of Robots or Animals
    • Member variables
    • Constructors
    • Member methods
    • Getters/setters
    • Static class methods
    • Inheritance - show some examples from FRC repos.
  • Arrays
    • Initialization
    • Iterating
    • Exercises: find the min, find the max, compute the average
  • Case statements
  • State machines
    • Soda vending machine
    • State transition diagram
    • What variables are needed,
    • Implementation as a class
  • Exceptions - throwing/handling
  • Wrap-up:
    • Tour of FRC code base.
    • Examples of state machines, inheritance
    • Show example of a shooting state machine from the code.
  • Installing WPILib, GitHub Desktop