Tomorrow, Careers in AI presentation. Come up with several questions you have about AI and related careers.
If you forget the format of an if/else statement google it to find examples that you can follow.
Code from yesterday - Mountville starter code
Create a new Java Class called BucketsOfPaint with a main method.
Write a program that calculates the number of buckets of paint to use for a room and the optimal number of cans to purchase.
You need to ask the height of the room and the length and width of the room. The room is rectangular. You must paint the walls and the ceiling but not the floor. There are no windows or skylights. You can purchase the following size buckets of paint.
• 5-liter bucket costs $15 each and covers 1500 square feet.
• 1-liter bucket costs $4 and covers 300 square feet.
What are the steps for solving this problem?
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
Begin Section 6 Lesson 1: Using Arrays slides
Begin Section 6 Lesson 1: Using Arrays quiz and show your results for teacher check
Begin work on the Section 6 Lesson 1: Using Arrays practice on school loop.
MountvileU Program Starter Code
// variables
Scanner input = new Scanner(System.in);
int students = 0;
double gpa = 0.0;
boolean accepted = false;
int satScore = 0;
String valedictorian = "";
System.out.println("Welcome to the Mountville University Acceptance Program");
System.out.println("How many students in your high school?");
students = input.nextInt();
if (students >=1400){
System.out.println("Were you the valedictorian or salutatorian? Enter Y for yes or N for no.");
valedictorian = input.next();
Copy and paste the following code examples into Eclipse:
LoopPractice
PalindromeTester