Yesterday was the last day to get Project 4.4 checked off for full credit, each day the score drops.
Create a new java project called 5-2 Control Statements. Now create class called Decoder. Copy the following into the program.
/*Consider you are asked to decode a secret message. The coded message is in numbers and each number stands for a specific letter. You discover enough of the secret code to decode the current message. So far, you know:
• 1 represents “D”
• 2 represents “W”
• 3 represents “E”
• 4 represents “L”
• 5 represents “H”
• 6 represents “O”
• 7 represents “R”
Write a program that prompts the user for 10 numbers, one at a time, and prints out the decoded message. If the user enters a number that is not one of those already deciphered, prompt him/her for a new number. Test your code with the following input: 5 3 4 4 6 2 6 7 4 1
*/
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.