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 Example: Created two names Name #1: Short name: Nathan Drake Full name: Nathan Francis Drake Formal name:Dr.Nathan Francis Drake Initials: NFD Last, First: Drake, Nathan Name #2: Short name: Fannie Farmer Full name: Fannie Francis Farmer Formal name: Mrs. Fannie Francis Farmer Initials: FFF Last, First: Farmer, Fannie
My bad it is Javascript for this programming language.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started