You are going to design (and code) a class called Name
. The class Name
will
contain three properties:
first
, the first name which is a Stringinitial
, the middle initial, which is
a single character.last
, the last name, which is a
StringThe class has three constructors:
In addition to the constructors, the Name class has the following methods:
readName()
- which prompts the user for
first name, middle initial and last name and reads them in.writeName()
- which prints the first name,
middle initial and last name with a blank separating them, but without a
newline (Use System.out.print()
.)
equals()
, which returns true if the names are the same, false otherwise (case should match as well).
Write another class complete with a main()that uses the new class that you wrote and demonstrates that these methods all work correctly.