2 3 /** 4 * A Java program to input strings and call methods strings. * Note: Codecheck will use different input values to test * the program, and you must use the specified variables in * your...


2<br>3<br>/**<br>4<br>* A Java program to input strings and call methods strings.<br>* Note: Codecheck will use different input values to test<br>* the program, and you must use the specified variables in<br>* your program.<br>7<br>8<br>*<br>* Step 2: Enter your name for @author and today's date for @version<br>* @author<br>* @version<br>*/<br>10<br>11<br>12<br>13<br>public class StringProg<br>{<br>public static void main(String [) args)<br>14<br>15<br>16<br>17<br>18<br>1 // Step 3: Create a new Scanner object<br>19<br>20<br>21<br>// Step 4: Display a prompt

Extracted text: 2 3 /** 4 * A Java program to input strings and call methods strings. * Note: Codecheck will use different input values to test * the program, and you must use the specified variables in * your program. 7 8 * * Step 2: Enter your name for @author and today's date for @version * @author * @version */ 10 11 12 13 public class StringProg { public static void main(String [) args) 14 15 16 17 18 1 // Step 3: Create a new Scanner object 19 20 21 // Step 4: Display a prompt "Enter multiple words separated by single spaces: " 22 23 24 // Step 5: Read in one line of input and store it in a variable line 25 26 // Step 6: Display line on one line within double quotes with message "The original line: " 27 28 // 29 30 31 // Step 7: Trime spaces from both ends of line and save it back to line 32 33 34 // Step 8: Display line on one line within double quotes 35 // with message "The line with spaces trimmed from both ends: " 36 37 38 // Step 9: Ask for a word with prompt "Enter a single word: " 39 40 41 // Step 10: Read in a single string and store it in variable word 42 43 44 // Step 11: Display word on one line within double quotes O 0 AO O Restricted Mode МacВook Air esc 80 F1 F2 F3 F4 F5 F6
// Step 12: Trime spaces from both ends of word and save it back to word<br>// Step 13: Display word on one line within double quotes<br>//<br>with message

Extracted text: // Step 12: Trime spaces from both ends of word and save it back to word // Step 13: Display word on one line within double quotes // with message "The word with spaces trimmed from both ends: " // Step 14: Find out if line contains word and assign the result to a variable true0rFalse // // Step 15: Display the value of trueOrFalse on one line with message "The line contains the word: " // // Step 16: Find out the index of word within line and assign the result to an integer variable pos // // Step 17: Display the value of pos on one line // with message "The index of word in line: " // Step 18: Find out the index of the first space within line and assign it to pos // // Step 19: Display the first word of line on one line within double quotes with message // // "First word of line: " // Step 20: Find out the index of the second space within line and assign it to another int variable // // Step 21: Display the second word of line within double quotes with message // // "Second word of line: "
Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here