Section 5 quiz will be Friday. Take the quiz today or tomorrow for practice - if you like your score show it to me.
All of 5.2 assignments are due Friday.
Intro to Section 5 Project - start with your Section 4 Project
- Prompt the user for the data needed to create a new product for your store.
- Use the data the user has provided to create the new product.
- Repeat to create a second new product.
- Discontinued - create a boolean variable to indicate if a product has been discontinued - no more will be ordered.
- Stock Value - create a method that calculates the stock value of an item.
- Update your toString() method to include Status and Stock Value.
- Demonstrate your program for teacher check.
Anagram Hints:
Be sure to check the Java API for the String methods that you can use. One of the things you will need is the length of the word or phrase so you know how many letters you are dealing with. You will also need to know the index of each character since you will be comparing characters.
Here is how the indexOf( ) method works
Here is how you check to see if a character is found in a string: if (word2.indexOf(c) = = -1) - if you ever get a -1 that means that character is NOT found in the string and thus you do NOT have an anagram. You will need to use a loop to pull out each character in the first word and see if it is in the second word.
Section 5 Lesson 2: Control Statements Vocabulary:
- A post-test loop that executes an unknown number of times until a condition is met, but always executes the first time through the loop.
-
A pre-test loop that uses an iterator to keep track of how many times a loop will execute.
-
A keyword used to skip over the remaining code in a loop and return program control to the beginning of the loop to execute again.
-
A pre-test loop that executes an unknown number of times until a condition is met.
-
A keyword used to terminate a loop from executing before the loop condition is met.
Complete Section 5 Lesson 2: Control Statements slides
Complete Section 5 Lesson 2: Control Statements questions and show them to your instructor for teacher check.
Complete work on the Section 5 Lesson 2: Control Statements practice on school loop.
Section 5.2 Coding - show your programs to your instructor for teacher check:
1.
Message Decoder - you must use only one println to print out the decoded message.
4. Anagram - hint sampleString.indexOf( characterX ) will return a -1 if the characterX is NOT found in sampelString. You will need to use a loop to pull out each character in the first word and see if it is in the second word.
Complete Section 5 Lesson 2: Control Statements project. Demonstrate for teacher check.
Complete Section 5 quiz and show your results to your instructor for teacher check.