Prompts the user for two years Y1 and Y2 in the range 1946--2021 and a proportion p,
Fantastic news! We've Found the answer you've been seeking!
Question:
- Prompts the user for two years Y1 and Y2 in the range 1946--2021 and a proportion p, hence a number in [0, 1], and finds out which names were given between Y1 and Y2 with a proportion as a (female or male) name at least equal to p, the proportion as a female name and the proportion as a male name being as close as possible.
- - When many names exist with that minimal difference in proportions, results are output from largest to smallest proportion as a (female or male) name.
- - When many names exist with that minimal difference in proportions and the same proportion as a (female or male) name, results are output with names in lexicographic order.
- Given a name N,
- - the proportion of N as a (female or male) name is the number of times N has been given between Y1 and Y2 as either a female or a male name divided by the total number of newborns between Y1 and Y2;
- - the proportion of N as a female name is the number of times N has been given between Y1 and Y2 as a female name divided by the total number of female newborns between Y1 and Y2;
- - the proportion of N as a male name is the number of times N has been given between Y1 and Y2 as a male name divided by the total number of male newborns between Y1 and Y2.
- The directory named names is stored in the working directory.
Related Book For
Posted Date: