Your cart is currently empty!
The purpose of this assignment is to get experience with the strings, regular expressions, Lists, operators, and indexers. Specifications The Name Class A person’s name may be in any form typically used for names in this country. Examples include the following. Will E. Makit I. M. Smart chauncey c. chauncey, iii Betty Wont Kute, U.…
The purpose of this assignment is to get experience with the strings, regular expressions, Lists, operators, and indexers.
A person’s name may be in any form typically used for names in this country. Examples include the following.
Will E. Makit I. M. Smart chauncey c. chauncey, iii
Betty Wont Kute, U. R. Morton Downey, Jr
Ima Raven Nutt, IV Colder, I. Ben, Jr. McPherson Mack Pherson, MD
Thayer B. Fuddled Badly, Claude Sue N. Lawyer, JD
U. Ara Nice Pursun Dr. Heza Dummox I. N. Stein, PhD
SAM SMITH-JONES mckensie j. quincy macdonald o’reilly, riley
Develop a Name class that keeps track of the name and its components. It should provide the functionality to decompose and recompose/format any name in any of the various forms. Only “American” types of names need be handled.
The Name class should have a default constructor, a copy constructor, and a parameterized constructor. The third of these constructors should accept a string representing a name in any of the permissible formats and decompose it appropriately into its components. The case of the letters in the name components should be adjusted so that, when displayed, the names appear correctly. The Tools.Tokenize method may be of use.
The Name class should have methods that return strings. One should contain the name in the form of first name first (such as I. Ben Colder, Jr.). Another should return the name in the form of last name followed by a comma, followed by the rest of the name (such as Makit, Will E., PhD).
The Name class must implement the IEquatable<Name> and IComparable<Name> interfaces according to the standards and techniques discussed in class. The comparisons of two Name objects should be based on a String comparison of a combination of the Last, Rest, and Suffix properties, in that order. The comparisons should ignore case differences.
/// <summary>
/// Display a Press Any Key to … message at the bottom of the screen
/// </summary>
/// <param name=”strVerb”>term in the Press Any Key to … message; default: “continue . . .”</param>
public static void PressAnyKey (string strVerb = “continue …”)
{
Console.ForegroundColor = ConsoleColor.Red;
if (Console.CursorTop < Console.WindowHeight – 1)
Console.SetCursorPosition (0, Console.WindowHeight – 1);
else
Console.SetCursorPosition (0, Console.CursorTop + 2);
Console.Write (“Press any key to “ + strVerb);
Console.ReadKey ( );
Console.Clear ( );
Console.ForegroundColor = ConsoleColor.Blue;
} // End PressAnyKey
/// <summary>
/// Skip n lines in the console window
/// </summary>
/// <param name=”n”>the number of lines to skip – defaults to 1</param>
public static void Skip (int n = 1)
{
for (int i = 0; i < n; i++)
{
Console.WriteLine ( );
}
}
Follow the instructions found on the Fact Sheet for the course that was distributed at the first class meeting and that is posted on the course web site. Turn in the entire project zipped, less the bin and obj folders that you must delete. Please include your text file containing the names with which you tested your project.