Lab
4: Using Java Classes
Background:Lab 4 will be an exercise in using Java classes and in writing your first Java applications. You will modify the NameInitials.zip demo project so that the user will enter the first, middle, and last name from the keyboard as one string, and then display the three initials in lower case as the demo currently does. The second project will have you enter a four word phrase from the keyboard and build a String object of the four words in reverse order to display.Lab 4a: Modify Name Initials DemoDownload the lab4.zip file. Save the zip file to your C:\Temp directory and unzip the files. Open the directory NameInitials. You should see the following files:
The taskThe user will enter a first, middle, and last name from the keyboard as a single String object. Using the appropriate String methods (including indexOf(); see the API), the program will get the first initial from each name and make a new string of the initials, to be displayed.Modifying the Name Initial programFor this exercise, all of your work will be done in NameInitial.java. You must modify the code in NameInitial.java . You only have to modify the existing main() method to solve the problem. Do not change any of the code that is currently in NameInitial.java. Comments in the file indicate what and where the modifications should be made.Lab 4b: Reverse a StringInside the lab2 directory, you will see the directory ReverseString. Open it. You should see the following files:
Go to the top of the project window and select Project / Run or click the small arrow head (looks like the Play button on a VCR / DVD player) in the middle of the project window menu bar. You will see that essentially nothing happens. The taskThe user will be prompted to enter a four word phrase from the keyboard, to be read as a single string,i.e. How now brown cow The user will use the appropriate String methods, to build another single String with the words in reverse order, to be displayed i.e. cow brown now How A solution in which the user enters four different String objects from the keyboard, and displays them in reverse order without parsing a single String and building a single string will receieve no credit for this problem. DesignUse the appropriate String member functions to solve this problem. Your entire solution will be written in the main() method of the ReverseString class.
Handing in your SolutionYour solutions should be in the form of .zip files. When we grade your solution we will unzip the folder and execute the project. If your project does not run you will lose the execution points for that lab.Your Solution zip file must contain all the files in your projects Your teaching assistants will show you how to zip up the
files for submission. Instructions are also in the Tutorial
document that is available
Click on this link to Submit your zip file |