At the end of this lesson, you will be able to:
A2.3 write algorithms with nested structures (e.g., to count elements in an array, calculate a total, find highest or lowest value, or perform a linear search).
understand and use nested if statements
With a pencil and paper, answer the following questions:
Write an example in daily life that uses each of the following logic operators, written in everyday language:
a) AND
b) OR
c) NOT
Use the compound operators (not, and, or) to create a pseudocode for the following program:
Ask the user for the day of the week (i.e. Monday, Tuesday, etc.)
If it is not Saturday or Sunday, tell them they have to go to school. Otherwise, tell them they can sleep in!
Write 2 test cases for the above program (1 test case for a weekday, 1 test case for a weekend).
ICS3U Only: What would happen if the seed (outlined in red) was not created? What is the purpose of creating a seed for random number generators?
compound boolean expressions
from the online book Computer Based Problem Solving by Patrick Coxall, read:
Nested If statements:
an IF statement inside another IF statement
Read "What is a Leap Year?" to determine what is a "leap" year.
Create a program that will ask the user to enter a year and then tell the user if it is a "leap" year.
Use the % (modulo) operator to find the remainder when dividing.
Make sure to "catch" any invalid entries so that your program does not crash.
in groups of 2, do the following on the board for today's daily assignment:
Top-Down Design
Flow Chart
Pseudocode
Test Cases
complete the Daily Assignment section in Hãpara Workspace for this day
if Hãpara is not working, make a copy of this document
move it to your IMH-ICS folder for this course
recreate the same program in C++