Question: This lab assignment is a continuation of the class exercise that we did using the files of baby names from the social security administration. Unlike
This lab assignment is a continuation of the class exercise that we did using the files of baby names from the social security administration. Unlike other labs, your program must use a function. The function prototype is:
int getRankchar userName char file int gender;
where userName is a name entered by the user, file is the name of the file being searched, and gender is a if the list of boy baby names first name on a row is being searched or a if the list of girl baby names second name on a row is being searched. Be sure to validate the number being entered for the gender. It must be a or The function returns the rank if found, but returns if the name isn't found in the file.
Your program should ask the user for the name to be searched and the gender of the baby which list should be searched Then it should search the following files:
PopularNamesstxt
PopularNamesstxt
PopularNamesstxt
PopularNamesstxt
The results should be printed in a table format where the name is first, then it has Year and Rank with a line consisting of equal signs beneath. Below those headings it should print the year and the rank of the user's name. If the name isn't found it should print "Not ranked in top
Here's a sample execution.
Enter your name: Clarence Enter to search boys names or to search girls names: ERROR: You must enter a or a Please reenter: Clarence: Year Rank Not ranked in top Not ranked in top
Please note that the names of the files start with a capital letter. When I uploaded them into Zybooks, they were all automatically capitalized. There doesn't appear to be a way to change the names so that they start with a lower case letter as they were in the class example.
Test checks that you're getting information from the user and printing the correct headings. It's worth points.
Test checks that you're reading information from the file and finding the correct ranks for the name Clarence. It's worth points.
Test checks that you're validating the integer entered for the gender, as well as getting the correct ranks. It's worth points.
Test checks that you're able to work with girls names and get their correct ranks. It's worth points.
Test makes sure that you are using the correct function. Remember that it must return the rank as an integer. You will need to use the atoi function that we discussed in the last chapter when we covered strings. This test is also worth points.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
