Question: Array I/O Write a program that uses an array to do the following: 1. Declare an array that will hold 10 letters from the alphabet.
Array I/O
Write a program that uses an array to do the following:
1. Declare an array that will hold 10 letters from the alphabet.
- You will have to declare the array datatype as String for this because we haven't covered how to parse Strings into characters yet.
- You aren't required to error check to make sure that the data entered is one character in length.
2. Using a FOR loop to store the characters in the array, do the following within the loop:
- Prompt the user for the letters by indicating which letter number they are to enter next. For example, ask for Letter #1, Letter #2, etc.
- As the letters are entered, place them in an array.
3. Using a second FOR loop (don't do this in the first FOR loop from step 2) print out each letter that was stored in the array.
NOTE 1:
- DO NOT use the "return 0" code, end, break, or exit to force an exit from within your IF/ELSE structure.
- Let the program progress to the end of the main method.
- A SWITCH statement is the only place that the break command should be used.
- DO NOT use the "continue" statement.
NOTE 2: 1. Declare all variables within the data declaration section of each class and method. (-.1) 2 Do not get input on the same line as a variable declaration. (-.1) 3. Do not place an equation for computation on the same line as declaring a variable. (-.1) 4. Do not place an equation for computation on the same line as an input statement. (-.1)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
