At the end of this lesson, you will be able to:
understand boolean expressions
create if..then statements
With a paper and pencil, complete the following questions:
Declare a variable in Python AND C++ called "subtotal" that holds the value 12.99.
Cast the above variable to an integer called "subtotal_int" in Python AND "subtotalInt" in C++.
Declare a constant string in Python AND C++ for the Immaculata slogan "Go Saints!".
Create the top-down design for a program that asks the user for the cost of an item and tells them the tax in Alberta, which has GST of 5%.
Create 1 test case for the above program.
tax program
when displaying money, always:
use $, even in your test cases
round to 2 decimal places, even in your test cases
make sure to write specific comments
example of a bad comment:
# input
# process
# output
example of a good comment:
# get the subtotal
# calculate the tax and total
# display the tax and total
make sure to have a line break BEFORE the comment for readability
# get user input
subtotal = float(input("Enter subtotal: $"))
# calculate the tax amount and the total with tax
tax = subtotal * constants.TAX_RATE_ONTARIO / 100
total = subtotal + tax
from the online book Computer Based Problem Solving by Patrick Coxall, read:
comparison operators return true or false
"=" is an "assignment statement"
"==" is a "comparison operator"
we use a diamond to represent a decision in a flowchart
create the "Too Many Students" program
step through it using the Codespaces debugger
notice how it will only print something if the number is over 30
read "Python if..else statement"
watch the video within until 3:50
create a program that asks the user to enter a number between 0 and 9
create a constant that is the correct number of your choice
if the user guesses the correct number, it says: "You guessed correct!"
if the user guesses incorrectly, it says: "You guessed wrong!"
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++