Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can I get this program in C please? The program must use a function prototype which is: int getRank(char userName[], char file[], int gender); The

Can I get this program in C please? The program must use a function prototype which is: int getRank(char userName[], char file[], int gender);
image text in transcribed
image text in transcribed
The function prototype is:
int getRank(char 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 1 if the list of boy baby names (first name on a row) is being searched or a 2 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 1 or 2.
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:
PopularNames1900s.txt
PopularNames1950s.txt
PopularNames1990s.txt
PopularNames2000s.txt
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 200".
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 1 checks that you're getting information from the user and printing the correct headings. It's worth 20 points.
Test 2 checks that you're reading information from the file and finding the correct ranks for the name Clarence. It's worth 20 points.
Test 3 checks that you're validating the integer entered for the gender, as well as getting the correct ranks. It's worth 20 points.
Test 4 checks that you're able to work with girls names and get their correct ranks. It's worth 20 points.
Test 5 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 20 points.
There are four files, however; I was not able to upload them..
image text in transcribed
image text in transcribed
Int getRank(char userNamell, char filelint gender) where userName is a name entered by the user, file is the name of the file being searched, and gender is a 11f the list of boy baby namen (first name on a row) is being searched or a 2 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 1 or 2 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: Popular Names 1900s.txt Popular Names 1950s.txt Popular Names 1990s.txt Popular Names 2000s.txt 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 of the name isn't found it should point "Not ranked in top 2000 Here's a sample execution 3 Enter your name: Clarence Enter 1 to search boys names or 2 to search girls Dameni ERROR: You must enter a 1 ora 2. Please re-enter: 1 Clarence: Year Rank 1900 1950 1990 2000 17 116 Not ranked in top 200 Not rankedin top 200 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 Notranked in top 2009 Here's a sample execution 3 Enter your name: Clarence Enter 1 to search boys names or 2 to search girls names: ERROR: You must enter a 1 ora 2. Please re-enter: 1 Clarence: Year Rank 1900 1950 1990 2000 17 116 Not ranked in top 200 Not ranked in top 200 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 1 checks that you're getting information from the user and printing the correct headings. It's worth 20 points Test 2 checks that you're reading information from the file and finding the correct ranks for the name Clarence. It's worth 20 points. Test 3 checks that you're validating the integer entered for the gender, as well as getting the correct ranks. It's worth 20 points Test 4 checks that you're able to work with girls names and get their correct ranks It's worth 20 points. . Test 5 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 atoio function that we discussed in the last chapter when we covered strings. This test is also worth 20 points. 291 1692152 LAS ACTIVITY 771 Baby Names 07 100 Submission Instructions Here's a sample execution 3 Enter your name: Clarence Enter 1 to search boys names or 2 to search girls namest ERROR: You must enter a lona 2. please re-enter: 1 Clarence: Year Rank 1900 1950 1990 2000 17 116 Not ranked in top 200 Not ranked in top 200 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 1 checks that you're getting information from the user and printing the correct headingsit's worth 20 points. Test 2 checks that you're reading information from the file and finding the correct ranks for the name Clarence. It's worth 20 points restored that revalidating the interested for the gender as well as in the eartestranken 20. Riks Searcmre Tonowing . . . Popular Names1900s.txt Popular Names 1950s.txt Popular Names 1990s.txt PopularNames 2000s.txt 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 200 Here's a sample execution 3 Enter your name: Clarence Enter 1 to search boys names or 2 to search girls name: ERROR: You must enter a 1 or 2. Please re-enter: 1 Clarence: Year Rank 1900 1950 1990 2000 17 116 Not ranked in top 200 Bot ranked in top 200 Please note that the names of the files start with a capital letter when I uploaded them into 2ybooks, 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 I checks that you re getting information from the user and printing the correct headings its worth 20 points. Test 2 checks that you're reading information from the file and finding the correct ranks for the name Clarence it's worth 20 points Test 3 checks that you're validating the integer entered for the gender as well as getting the correct ranks it's worth 20 points Test 4 checks that you're able to work with girls names and get their correct ranks. It's worth 20 points Test 5 make sure that you are using the correct function Remember that it must return the rank as an integer. You will need to use the ato function that we discussed in the last chapter when we covered strings. This test is also worth 20 points

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions

Question

The IPO Investment Bank has the following financing outstanding....

Answered: 1 week ago

Question

Prove Equation (5.22).

Answered: 1 week ago

Question

to encourage a drive for change by developing new ideas;

Answered: 1 week ago

Question

4 What are the alternatives to the competences approach?

Answered: 1 week ago