Variables, Conditionals, and Functions - Lesson 8: Conditionals Make

Overview

Using Programming Patterns and a step-by-step approach students make their own version of a Museum Ticket Generator app. At the beginning of the lesson students are able to explore a working version of the app. They are then given the design elements of the app but begin with a blank screen. A progression of levels guides students on the high level steps they should use to develop their app but leaves it to them to decide how to write the code. At the end students submit their apps which can be assessed using a provided rubric.

Goals

Students will be able to:

  • Recognize the need for programming patterns with Boolean expressions and conditional statements as part of developing a functioning app
  • Implement programming patterns with boolean expressions and conditionals statements to develop a functioning app
  • Write comments to clearly explain both the purpose and function of different segments of code within an app
  • Use debugging skills as part of developing an app

Purpose

This lesson is an opportunity for students to take on the "blank screen" and build the code that runs an app entirely from scratch. Guidance provided throughout the lesson helps students break down the large task of "building an app" into more incremental steps that they can use on future projects, including this unit's final project and the Create PT.

Resources

Supplemental Code.org material

For the students

Getting Started (2 minutes)

Teaching Tip

Short Intro: The warm up today is short and light. Students should spend the maximum amount of time working on their projects.

Remarks

  • For the past few days, we've learned a lot about using conditional statements to help apps make decisions. In today's Make Project you'll be practicing both making flow charts and writing complex conditionals statements as you build a Museum Ticket Generator app.

Activity (38 minutes)

Group: Make a determination as to whether this project will be completed in pairs or individually. You may even choose to let students decide.

Distribute: Make sure students have access to scrap paper and pencils / paper for drawing flow charts, or any alternative materials you may ask students to use instead.

Open a Project: Direct students to open the Lesson8_ExampleApp project from the CSP-Widgets repository. Have students explore the working Museum Ticket Generator App. If students are not working in pairs they should still discuss the prompts with a neighbor.

Prompts

  • What does this app do?
  • What are the inputs?
  • What are the outputs?
  • What variables do you think would be necessary for this app to work?
  • What kinds of conditional logic do you think are necessary to make it work?
Discussion Goal
  • Answers are provided in Unit4AnswerKey repository.
Teaching Tip

Supporting Students: While students are working on their apps, circulate the room and check in with students who need a little help. Encourage students to collaborate and discuss bugs with each other.

Debugging: Review with students steps they can use to debug if they get stuck:

  • Output the variables at different points in the program
  • Explain the code to a friend

Remarks

  • Now let's build this app. The screen has been set up for you - it's your job to add the code!

(Optional) Distribute: Give students copies of CSP Conditionals Make - Museum Ticket Generator App (Activity Guide) if you will be using it during the class.

Open a Project: Direct students to open the Lesson8_ProjectTemplate project.

Do This: Based on the needs of your classroom decide whether you will collectively go through the activity guide or have students complete it individually. Afterwards give them time to work on their projects and circulate the room to offer support. Students who finish early can work on the extensions suggested in the activity guide.

Submit: Encourage students to check the rubric on the last page of the Activity Guide before submitting.

Wrap Up (5 minutes)

Remarks

  • Awesome work today! Make sure to submit your project when you're done with it!
Teaching Tip

Maximize Work Time: The wrap up is short to allow the maximum amount of time for students to complete the activity.

Assessment

Project: Use the rubric provided with the project to assess student projects.

Standards Alignment

  • CSTA K-12 Computer Science Standards (2017): 2-AP-10, 2-AP-12, 2-AP-19, 3B-AP-21

Next Tutorial

In the next tutorial, we will discuss CSP Unit 4 Lesson 9 Functions Explore / Investigate, which describes Explore and investigate functions.