0% found this document useful (0 votes)
8 views8 pages

Unit 1 Lesson 4 Expressions and Assignment Statements Lesson Plan

Uploaded by

vandana.giri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views8 pages

Unit 1 Lesson 4 Expressions and Assignment Statements Lesson Plan

Uploaded by

vandana.giri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Lesson Plan

Lesson 1.4: Expression and Assignment


Statements

Overview
This lesson introduces expressions and assignment statements that include
mathematical operators and variables and corresponds to the College Board AP
CSA topic 1.3. By completing this lesson, students learn about arithmetic
operators and how they are used, stored, operator precedence, and the outcome
of using each operator. Students are given an opportunity to use arithmetic
operators in the Java programming language.

Note: If you wish to provide a URL/link for students to access this lesson, you
will need to replace “yourCustomCourseName” in the customized link below
with the name of your custom course that you created. For instructions on how to
set up a custom course, please see https://www.csawesome.org/runestone-e-book.

Customized Link to Share:


https://runestone.academy/ns/books/published/yourCustomCourseName/Unit1-
Getting-Started/topic-1-4-assignment.html

Student Learning Objectives


ENDURING UNDERSTANDING

CON-1 The way variables and operators are sequenced and combined in an expression
determines the computed result.

1
Lesson Plan
Lesson 1.4: Expression and Assignment
Statements

LEARNING OBJECTIVE ESSENTIAL KNOWLEDGE

CON-1.A Evaluate arithmetic ➢ CON-1.A.1 A literal is the source code


expressions in a program representation of a fixed value.
code. ➢ CON-1.A.2 Arithmetic expressions
include expressions of type int and
double.
➢ CON-1.A.3 The arithmetic operators
consist of +, −, *, /, and %.
➢ CON-1.A.4 An arithmetic operation
that uses two int values will evaluate
to an int value.
➢ CON-1.A.5 An arithmetic operation
that uses a double value will evaluate
to a double value.
➢ CON-1.A.6 Operators can be used to
construct compound expressions.
➢ CON-1.A.7 During evaluation,
operands are associated with
operators according to operator
precedence to determine how they are
grouped.
➢ CON-1.A.8 An attempt to divide an
integer by zero will result in an
ArithmeticException to occur.

CON-1.B Evaluate what is stored in a ➢ CON-1.B.1 The assignment operator


variable as a result of an expression with (=) allows a program to initialize or
an assignment statement. change the value stored in a variable.
The value of the expression on the
right is stored in the variable on the

2
Lesson Plan
Lesson 1.4: Expression and Assignment
Statements

left.
➢ CON-1.B.2 During execution,
expressions are evaluated to produce a
single value.
➢ CON-1.B.3 The value of an expression
has a type based on the evaluation of
the expression.

Materials and Resources

● Presentation system (LCD projector/Interactive whiteboard)


● 1.4. Expression and Assignment Statements in the CSAwesome e-book
● User Input (optional YouTube video)
● Math Operators (optional YouTube video)
● Modulo operator (optional YouTube video with Apples and nets analogy)
● Modulo Operator (optional YouTube video with Clock analogy)
● Exit Slip for Day 1
● Worksheet - Math Operators Practice (Solutions)
● POGIL Day 1 and Solutions
● POGIL Day 2 and Solutions
● CSAwesome! Programming Solutions
● AP Classroom Personal Progress Check Part A for Unit 1 which covers
AP topics 1.1-1.3 (CSAwesome lessons 1.2-1.4).

3
Lesson Plan
Lesson 1.4: Expression and Assignment
Statements

Learning Activities

Estimated Length: 90 minutes

Day 1:

● Hook/Motivation (10 mins):


○ The basic arithmetic operators of +, −, /, and * are similar to what students
have experienced in math class or when using a calculator. Have students
come up with expressions using all 4 of the mathematical operators stated
above. First round they should be using numbers only, second round, they
should be using variables only and defining each variable.

Example: Round 1: 4+4/3-6*4 Round 2: x = 4, y = 3 and x + x / y - 6 *x

Have the students simplify the expression by hand and then enter their
expressions into a compiler and find an answer. Discuss how the answers
are different and why.

● Experiences and Explorations (30 mins):


○ Explain how the student’s expressions in the hook activity are expressions
that can be used in Java. Explain that in round 2, when they included
variables, these were assignment statements.
○ Direct Instruction:
■ Use the Java Visualizer in 1.4.1 Assignment in CSAwesome to show
how the variable values change with assignment statements. Have
students do the Check Your Understanding problems in 1.4.1 in
pairs.
■ Briefly demonstrate how you can collect user input running the
repl.it code in 1.4.2. You may choose to show the User Input Video
and demonstrate how input statements are constructed in Java.

4
Lesson Plan
Lesson 1.4: Expression and Assignment
Statements

■ Ask students to guess what Active Code 2 and 3 in 1.4.3 Operators


will print out before you run them together in class.
■ Explain the difference between mathematical division and integer
division and how it is used in programming. You may choose to
show the Math Operators (YouTube video).
○ POGIL / Collaborative Group work: POGIL - "/" Operator
● Rethink, Reflect, and/or Revise (5 mins):
○ Exit slip: What is the difference between mathematical division and
integer division?

Day 2:

● Hook/Motivation (5 mins):
○ Have students do a division problem like 15 / 4. Ask them what the
remainder is (3). Introduce the operator % (mod or modulo or remainder)
where 15 % 4 returns the remainder of 15 / 4. Go through the division
problems in Figure 1.
● Experiences and Explorations (35 mins):
○ Direct Instruction: Clarify what the mod operator is and what it does.
And give some examples of how it works, mathematically and using the
compiler. Have students guess what Active Code 4 will do in 1.4.4 before
running it and have them do the Check Your Understanding exercises in
pairs. You may choose to show one or both of these videos modulo
operator with apples and nets analogy and/or the modulo operator with
the clock analogy video. Distinguish between double division, integer
division and modulo.
○ POGIL / Collaborative Group work: POGIL - "%" Operator
○ Pair Programming: Have students do the Dog Years Programming
Challenge in pairs.

5
Lesson Plan
Lesson 1.4: Expression and Assignment
Statements

○ Independent Practice: Students will complete the Math operator


worksheet
● Rethink, Reflect, and/or Revise (5 mins):
○ Ask students to review the Summary section on the Runestone site and
complete the Math operator worksheet. Any unfinished questions should
be completed as homework.

Check for Understanding


● Interactive Exercises: 1.4.1 - 1.4.4
● Coding Exercises: Activecode 2 to Activecode 4; Programming Challenge
● Common Misconceptions:
○ Division and integer division use the same symbol.
■ Division when both numbers are integers provides an integer
answer. When one or both of your numbers are float types, your
result will be a float (decimal).
○ modulo is not integer division. You will get an integer answer, but the
result represents the remainder.
● Personal Progress Check (College Board): Go to AP Classroom to assign the
Personal Progress Check Part A for Unit 1 which covers topics 1.1-1.3 (in
CSAwesome that is lesson 1.2-1.4). Review the results in class to identify and
address any student misunderstandings.
Progress Check Part A (15 Questions) covers:
● AP topic 1.1 Why programming? Why Java? (System.out.print and
System.out.println); Questions 1 -6
● AP topic 1.2 Variables and Data types; Questions 7 – 9
● AP topic 1.3 Expressions and Assignment Statements 10 – 15

6
Lesson Plan
Lesson 1.4: Expression and Assignment
Statements

Differentiation: More Practice


● Mathbits.com provides some handy 1-2 page notebook style printouts
related to variables. These could be printed and provided to students to
use as a reference.
● MathTutorDVD.com provides several short video (< 10 mins) that
demonstrate how to use variables in Java.
● CodeStepByStep.com provides practice problems on various topics
covered.
● Khan Academy provides lessons and practice on various topics

Differentiation: Enrichment
● CodeStepByStep.com provides practice problems on various topics
covered.
● Practice It provides practice problems on various topics covered.
● Clock Arithmetic and Modular Systems1
● Pseudo Random Number Generator2

Background Knowledge

● Refer to Oracle's Java Documentation on Assignment, Arithmetic, and


Unary Operators.

1 "Clock Arithmetic and Modular Systems." Chapter 5 Number Theory. 2004. Pearson Education. 2019
<http://socrates.bmcc.cuny.edu/jsamuels/text/mhh-discrete-05.4.pdf>.

2 “Mobile CS Principles.” Mobile CSP, 2019, course.mobilecsp.org/mobilecsp/unit?unit=23&lesson=65.

7
Lesson Plan
Lesson 1.4: Expression and Assignment
Statements

Teaching Tips
● CSP → CS A Tips

○ In CSP - the block for modulo is , but in


java, the text model is: x % y where ‘%’ is the symbol for modulo
reads: x modulo of y. 10 modulo of 2 is 10 % 2
● Emphasize that floating-point division will not round up to the significant
digits. 11/4.0 is still 2.75, not 2.8.

Teacher Professional Development Reflection

After reviewing this lesson plan in the professional development, complete the form
found here to provide feedback on the lesson, materials provided, etc.

Attributions
1. “Clock Arithmetic and Modular Systems.” Chapter 5 Number Theory, Pearson
Education, 2004, socrates.bmcc.cuny.edu/jsamuels/text/mhh-discrete-05.4.pdf.
Accessed 2019.
2. “Mobile CS Principles.” Mobile CSP, 2019, course.mobilecsp.org/mobilecsp/unit?
unit=23&lesson=65.

You might also like