120 likes | 259 Vues
In this lesson, we delve into the principles of programming using BASIC. Students will compare and contrast two different tax calculation programs, analyzing arithmetic operators like addition and multiplication within them. We will also explore string variables by writing programs that accept user input, such as names and ages, and combine them. The lessons include a focus on creating a simple calculator program that handles basic operations and avoids division by zero errors. Complete your journal sections and exit slip to solidify your understanding.
E N D
Just Basic Lessons 7&8 Mr. Kalmes
Lesson 7 Objectives • Compare and contrast two different programs • Analyze different arithmetic operators
Previous Program Create the following Program Compare the two programs [beginning] print "Type a dollar and cent amount." input "(Press 'Enter' alone for help) ?"; amount if amount = 0 then goto [help] let tax = amount * 0.07 print "Tax is: "; tax; ". Total is: "; tax + amount goto [beginning] [help] print "This tax program determines how much tax is" print "due on an amount entered and also computes" print "the total amount. The tax rate is 7%" goto [beginning] Input “Enter a price, please: “; amount Let tax = amount*.07 Print “tax is: “; tax; “Total is: “; tax+amount
Journal Part 1 • Please click on your journal and complete sections 1 & 2
Operators Definition: mathematical symbols that generate an action in the program Examples: a = b a is equal to b a <> b a is unequal to b a < b a is less than b a > b a is greater than b a <= b a is less than or equal to b a >= b a is greater than or equal to b
Calculator Please create a calculator program that includes: • Add, Subtract, Multiply, Divide Sections • Must be able to repeat • Must be able to choose to repeat or end • Must have a way to get around divide by zero
Lesson 8 Objectives • Define strings • Understand the purpose of strings in BASIC programming
Variable & Strings What is a variable? String: String variables hold strings of characters (numbers, letters, and symbols) that can be used later in the program. Examples: • data$ • age$ • name$
String Program 1 Write the following program: input “Please type your age.”; age$ print “I can’t believe you are “; age$
String Program 2 Write the following program: input "What is your first name ?"; firstName$ input "What is your last name ?"; lastName$ let fullName$ = firstName$ + " " + lastName$ print "Your full name is: "; fullName$
Journal Part 2 Complete section 3 of your journal
Exit Slip Please complete your exit slip via google forms