Question: For this assignment you will create a class to represent a persons name along with a variety of methods for returning strings containing variants of
For this assignment you will create a class to represent a persons name along with a variety of methods for returning strings containing variants of the name. You should then create a driver program to create at least two Name objects, passing in four strings to each. One of the Names should be your own. For each of the name objects, the driver should then call each of the methods described below and display the strings returned in a manner similar to the example below. Note that the methods that make up the Name class DO NOT DISPLAY the names but only return Strings to the caller that represent the name specified. Class Name -prefix:String -first:String -middle:String -last:String +Name(String, String, String, String) +getShortName(): String +getFullName(): String +getFormalName(): String +getInitials(): String +getLastCommaFirst(): String
Name #2: Short name: Fannie Farmer Full name: Fannie Francis Farmer Formal name: Mrs. Fannie Francis Farmer Initials: FFF Last, First: Farmer, Fannie
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
