Really looking for some help with this final. I can get the if statement to work properly. We did not cover if statements that much.
Week 12 - Final Instructions
1. Create a class called Final.
a. The Final class should contain a main method.
2. Copy the following variable declarations below the main method.
int number1 = 0;
int number2 = 10;
int[] intArray = {2,4,6,8,10,12,14,16,18,20};
Scanner input = new Scanner(System.in);
String myString = "";
String myString2 = "This is an example of using the substring method.";
String myString3 = "When you come to a fork in the road take it.";
String mySubString2 = "";
int beginIndex = 22;
String[] splitArray;
String mySplit = "";
3. Create an if/else statement that compares number1 to number2.
a. If number1 equals number2 print:
i. "number1 is equal to number2"
b. If number1 does not equal number2 print:
i. "number1 is not equal to number2"
4. Using a for statement, print out the contents of intArray.
a. Print the index and the value in that element of the array.
b. See the Example Run for the format of the output.
5. Print out the following substring (include the double quotes) from myString2
a. "using the substring method."
b. See the Example Run for the format of the output.
6. Using the split method, split myString3 into words and store each
word in an element of the splitArray.
a. Then printout the splitArray using a for statement.
b. See the Example Run for the format of the output.
7. Ask the user to enter a string by outputting:
a. "Enter a string or enter the word stop to exit: "
8. Accept the user’s input by using the Scanner method nextLine.
9. Use a while loop to continue to:
a. Ask the user to enter a string
b. Accept user input
c. Print out what the user entered
d. until the user enters stop.
10. Print out the following message:
11. "I'm finally finished with the final!!!"
12. Run the Final program.
a. Enter:
i. I like
Java!!!
b. Enter:
i. Stop
13. Take a snapshot of your output.
14. Upload your code and snapshot to Canvas.