Write a code that uses national data on the relative


Assignment

Write a code that uses National Data on the relative frequency of given names in the population of U.S. births, stored in a directory names, in files named yobxxxx.txt with xxxx(yob1931.txt and yob1880.txt) being the year of birth (here ranging from 1880 to 1949, but it is arbitrary and could be different).

The code prompts the user for a first name, and finds out the first year when this name was most popular in terms of frequency of names being given, as a female name and as a male name.

The code should include the names in the notepad files. The code should produce the expected outputs for the following test cases.

Test Case 1
Enter a first name: notgivenyet
In all years, notgivenyet was never given as a female name
In all years, notgivenyet was never given as a male name

Test Case 2
Enter a first name: Zed
In all years, Zed was never given as a female name
In terms of frequency, Zed was the most popular as a male name first in the year 1894.
It then accounted for 0.01% of all male names.

Test Case 3
Enter a first name: Zilpha
In terms of frequency, Zilpha was the most popular as a female name first in the year 1888.
It then accounted for 0.01% of all female names.
In all years, Zilpha was never given as a male name.

Test Case 4:
Enter a first name: John
In terms of frequency, John was the most popular as a female name first in the year 1880.
It then accounted for 0.05% of all female names.
In terms of frequency, John was the most popular as a male name first in the year 1880.
It then accounted for 8.74% of all male names.

Test Case 5:
Enter a first name: Charlotte
In terms of frequency, Charlotte was the most popular as a female name first in the year 2013.
It then accounted for 0.53% of all female names.
In terms of frequency, Charlotte was the most popular as a male name first in the year 1907.
It then accounted for 0.00% of all male names.

Test Case 6:
Enter a first name: Madison
In terms of frequency, Madison was the most popular as a female name first in the year 2001.
It then accounted for 1.23% of all female names.
In terms of frequency, Madison was the most popular as a male name first in the year 1881.
It then accounted for 0.03% of all male names.

Test Case 7:
Enter a first name: Peter
In terms of frequency, Peter was the most popular as a female name first in the year 1887.
It then accounted for 0.00% of all female names.
In terms of frequency, Peter was the most popular as a male name first in the year 1957.
It then accounted for 0.54% of all male names.

Attachment:- Text-Files.rar

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Write a code that uses national data on the relative
Reference No:- TGS02722196

Expected delivery within 24 Hours