Please enable JavaScript to use CodeHS

AP Computer Science A (Nitro)

Description

In this lesson, students will be introduced to and practice using the Java main skeleton that includes the class and main method arguments. They will use the System.out.print and System.out.println commands to print string literals in the editor. This lesson corresponds with AP Computer Science A topic 1.1.

Objective

Students will be able to:

  • call system class methods to generate output to the console
  • recognize the difference between display behavior of System.out.print and System.out.println
  • create string literals
Description

In this lesson, students will learn about variables. Variables allow information to be stored such as numbers, words, or true/false expressions. A variable can be thought of as a box that stores information inside. In Java, variables are composed of three things: a name, type, and value. This lesson corresponds with AP Computer Science A topic 1.2.

Objective

Students will be able to:

  • declare, initialize and assign a value to a variable
  • identify the most appropriate data type category for a particular specification
  • categorize a data type as either primitive or reference
  • declare a final variable
Description

In this lesson, students learn how to use arithmetic expressions in Java. Arithmetic expressions allow the use of mathematical operations within Java. Students will also learn about the modulus operator (%) and how it is evaluated. Such expressions can be used for basic math and even more complex algorithms. This lesson corresponds with AP Computer Science A topic 1.3.

Objective

Students will be able to:

  • evaluate arithmetic expressions in a program code
  • use the modulus operator (%)
Description

In this lesson, students will learn how to use the increment operator (++), the decrement operator (--) and compound assignment operators (+=, −=, *=, /=, %=). The increment operator (++) and decrement operator (−−) are used to add 1 or subtract 1 from the stored value of a variable. The new value is assigned to the variable. This lesson corresponds with AP Computer Science A topic 1.4.

Objective

Students will be able to:

  • Evaluate what is stored in a variable as a result of an expression with an assignment statement
  • Use a compound assignment operators (+=, −=, *=, /=, %=) in place of the assignment operator
  • Use an increment operator (++) or decrement operator (−−) to add 1 or subtract 1 from the stored value of a variable
Description

In this lesson, students will learn how to receive user input with the Scanner class in Java. After creating a new Scanner object, they will learn the commands below that will allow them to take in data from the user.

String name = input.nextLine();
int number = input.nextInt();
double decimal = input.nextDouble();
Objective

Students will be able to:

  • import and initialize a new Scanner to take in user input
  • create variables that take the assigned value of the user input.
  • choose the correct command that will allow the program to receive the input value that corresponds with its desired data type

Enduring Understandings

This lesson builds toward the following Enduring Understandings (EUs) and Learning Objectives (LOs). Students should understand that…

  • EU (Var-1) To find specific solutions to generalizable problems, programmers include variables in their code so that the same algorithm runs using different input values. (LOs 1.A, 1.B)
Description

In this lesson, students will learn how to change the data type of a value through the process of casting. They will also use casting to help round double values to the closest integer value. Students will explore the range of variables allowed in Java and understand integer overflow when a value outside of this range is attempted. This lesson corresponds with AP Computer Science A topic 1.5.

Objective

Students will be able to:

  • Evaluate arithmetic expressions that use casting
  • Understand that integer values in Java are stored using a finite amount (4 bytes) of memory. Therefore, an int value must be in the range from Integer.MIN_VALUE to Integer.MAX_ VALUE inclusive
  • Understand when an expression evaluates to an int value outside of the allowed range, an integer overflow occurs
  • Recognize and use implicit casting
  • Use casting to round to the nearest integer