Welcome Back - Today - Conditional Statements
Create a new Java Project called 5-1 Conditional Statements
Now create a new java class called MountvilleU inside this project. Add comments based on class notes
/*
Write a Java program that will decide if a student gets into Mountville University. Students must have one of the following criteria:
• been a valedictorian or salutatorian of a school of 1400 or more
• had a gpa of 4.0 or better and a SAT score of 1100 or more
• had a gpa of 3.5 or better and an SAT score of 1300 or more
• had a gpa of 3.0 or better and an SAT score of 1500 or more
What variables should you create and what type should each variable be?
What is the first question you should ask?
*/
Finish Section 5 Lesson 1: Scanner and Conditional Statements slides
Finish 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 brought to you by...
#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.
Relational operators, logical operators &&, ||, !
The ternary operator (?:) - an if else short cut
int x = c > 9 ? 6 : 7; //If c is greater than 9, x is 6; else x is 7
Anagram Hints - refer to section 4.3 Strings for the methods used to extract a character from a string.
You will need to use the input.nextLine() method instead of the input.next() method in order to retrieve an entire phrase and not just the first word of the phrase. |
Final hint - strings are arrays of characters, you will need to check to see if each character in the first string matches any character in the second string. If the letter is NOT in the array then the index value that is returned would be -1.
2D Arrays Tutorial
Intro to Arrays
Maze
MazeMan
MazeManApplet
Begin Section 6 Lesson 1: Using Arrays slides
Complete Section 6 Lesson 1: Using Arrays quiz and show your results for teacher check
Complete work on the Section 6 Lesson 1: Using Arrays practice on Moodle