Programming Assignment 3
CS 12300
Programming I: Java
Fall, 2020

This assignment is due Tuesday, September 29.

This assignment makes use of the files contained in this zip file.

Write a Java class called Hw3.java which will use a Scanner object to read a line of text as input and then use System.out.println to display the input line with its first word moved to the end of the line and with the new first word capitalized. For example, a possible sample interaction with the user might be

Enter a line of text. No punctuation please.
Java is the language
I have rephrased that line to read:
Is the language Java

Assume that there are no spaces before the first word in the input line and that the end of the first word is indicated by a space, not by a comma or other punctuation. When the first word from the input line is moved to the end of the line, it should have one space between it and what was last word of the input line.

Be sure that the output of your program does not include any leading spaces. So for example, if the input to your program is the following line of text

This    line is spaced    funny

then the output of your program should be like this

Line is spaced    funny This

and not like this

    line is spaced    funny This

Notice how the extra spaces between the words "This" and "line" were dropped from the correct output.

For this assignment you will use methods from Java's String class and Java's Scanner class. In the zip file there are a few documents that summarize some of the methods that you might want to use from those two classes. Also, be sure that you read Section 2.7 String Methods and do all the problems in that section.

In this assignment's zip file there are some files that let you test your program. Download and unzip the zip file. Copy your solution file Hw3.java into the unzipped hw3 folder and then compile your Hw3.java file to produce Hw3.class.

Use your keyboard and mouse to "Shift-Right-Click" on an empty space in the hw3 folder and select the pop-up menu item "Open command window here". You should now see a "command prompt" window. Click on this window and type the following command. (Notice that hw3> is the command-line "prompt". You type what comes after the prompt.)

hw3> run_test_script.cmd

That command should produce some output in the command window and the output should look exactly like the contents of the file test_script_output.txt from this assignment's zip file.

Turn in a zip file called CS123Hw3Surname.zip (where Surname is your last name) containing your version of Hw3.java.

This assignment is due Tuesday, September 29.