Create a class named <your name>_Name that represents a person's name. The class should have fields representing the person's first name, last name and middle initial. Write an toString instance method for the class that returns a String such as "John Q. Public"; please note the period after the middle initial is not stored in the field ... it is added by the toString method. Also note the toString method does NOT print the string, it only constructs and returns it.
Next create test program (new class with a static main method) called <your name>_ClassIntroQuiz. In main create a new instance of your Name class called "name", initialize the fields with the values listed below, and then print the name by calling System.out.println(name).
Field | Value |
---|---|
first name | John |
last name | Public |
middle initial | Q |
Your program must EXACTLY match the designated output found in ClassIntroQuizOutput.txt. Make sure you use the output comparision tool!
You will be creating two files: one for the Name class and the second for the test program. The Name class will be a non-static (instance) class, whereas your test program class will contain the normal "public static void main" method.
Submit both source code files to me as usual via DropItToMe
Follow class programming standards and formatting/indentation rules. Make sure you comment your code!
The quiz is worth 35 points.
This is pretty simple...you get 100% if your output exactly matches the expected output...and...0% if it has ANY differences.
Make sure you get all the spelling, capitalization, punctuation, spacing, etc. correct! Hint: copy-n-paste is a wonderful thing! :)