Section 4 quiz Friday!
Friday is the last day for submitting Section 4 work.
Introduction to If Statements and Conditionals
if( condition goes here - must evaluate to either true or false)
{
this code is executed if the condition evaluates to true.
}
else - is optional
{
this code is executed if the condition evaluates to false.
}
Instead of an else statement you can also use an else if statement
if( condition)
{
this code is executed if the condition evaluates to true.
}
else if(condition)
{
this code is executed only if the first if condition was false and the second if condition was true.
}
Common Mistakes with If/Else statements - placing a ; after the condition, this exits the if statement
Begin Section 5 Lesson 1: Scanner and Conditional Statements slides
Begin work on the Section 5 Lesson 1: Scanner and Conditional Statements practice.
#2 Math Calculator - the output should read _______ (the first value entered) math operator chosen _______ (second value entered)
= _______ your calculated value goes here. Here is an example 5 * 6 = 30
Thanks for using this program.
#4 Planets - Your weight on ____________ (planet name) is ________ pounds.
Example - Your weight on Mars would be 45 pounds.
Thanks for using this program.
#5 Mountville U - When you run this program it should NOT ask for information that is not needed once acceptance has been determined.
#6 Exam Exemption
#7 BucketsOfPaintCalculator
Your room with a width of _________, a height of __________, and a length of _________ has an area of __________ sq. ft.
This room will require ______ 5-liter buckets and ________ 1-liter buckets.
Section 5 Lesson 1: Scanner and Conditional Statements Vocabulary:
- A shorthand form of an if/else statement.
-
A Java class used for reading keyboard or file input during program execution.
-
A type of program control that allows different segments of code to execute when the input value matches a given condition.
-
A type of program control that allows different segments of code to execute when the input value matches a given condition - another way of doing this that is different from your previous answer.
Begin Section 5 Lesson 2: Control Statements slides
Begin work on the Section 5 Lesson 2: Control Statements practice.