The attached file, CommonFemaleNames.txt, contains the top 1000 female names in the United States. The format is integer string where the integer is the popularity number (1 is most popular) and...

The attached file, CommonFemaleNames.txt, contains the top 1000 female names in the United States. The  format is integer string where the integer is the popularity number (1 is most popular) and string is a female  first name. The program is to read the list of names and create an array of objects. It then sorts the array in  alphabetical order. The user enters a name, which the program searches for and then reports how common  that name is. The program is to use two different search algorithms, a linear search and a binary search. It  reports on how many microseconds it takes to find the name using each method.  Requirements 1. Each name and popularity number must be stored in a separate object.  2. The names on the list are all uppercase, but the program must find the name even if it is entered in  lower case. Do this by converting the entered name to all caps.  3. It must give an appropriate message if the name entered is not on the list.  4. Both a linear and a binary search are required, for each name entered and the time it takes for each  one reported.  5. Either the sort or the binary search must use a recursive method (Hint: a recursive binary search is  easier than a recursive sort) Note: It works best if namePair is an array of pointers to  CommonName (My UML creator won’t let me show that)  Extra Credit • Use quicksort to sort the name objects (5 points)  • Throw an exception when a name is not found. Handle it in the calling procedure (5 points)
Name<br>- namePair: CommonName []<br>- nextname: int<br>+ Name()<br>+ addName(pair: CommonName): void<br>+ sortNames(): void<br>+ findLinear(name: string): int<br>+ findBinary(name: string): int<br>- findRecursive(name: string, low: int, high: int): void<br>Note: It works best if namePair is an array of pointers to<br>CommonName (My UML creator won't let me show that).<br>CommonName<br>- ordinal: int<br>- name: string<br>+ CommonName(ord: int, aName: string)<br>+ getOrdinal(): int<br>+ getName(): string<br>

Extracted text: Name - namePair: CommonName [] - nextname: int + Name() + addName(pair: CommonName): void + sortNames(): void + findLinear(name: string): int + findBinary(name: string): int - findRecursive(name: string, low: int, high: int): void Note: It works best if namePair is an array of pointers to CommonName (My UML creator won't let me show that). CommonName - ordinal: int - name: string + CommonName(ord: int, aName: string) + getOrdinal(): int + getName(): string
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here