Question
Write a program that reads a file containing data about the changing popularity of various baby names over time and displays the data about a
Write a program that reads a file containing data about the changing popularity of various baby
names over time and displays the data about a particular name. Each line of the file stores a name
followed by integers representing the names popularity in each decade: 1990, 1910, 1920, and
so on. The rankings range from 1 (most popular) to 1000 (least popular), or 0 for a name that was
less popular than the 1000
th
name. A sample file called
population.txt
has been given to
you. Your program should prompt the user for a name and search the file for that name. If the
name is found, the program should display the data about the name on the screen. If the name is
not found, then display the message
Name not found in the file
Sample Output:
Name?
Sam
Statistics on the name Sam
1900: 58
1910: 69
1920: 99
1930: 131
...
This is the input
Sally 0 0 0 0 0 0 0 0 0 0 886 Sam 58 69 99 131 168 236 278 380 467 408 456 Samantha 0 0 0 0 0 0 272 107 26 5 7 Samir 0 0 0 0 0 0 0 0 920 0 798
This is using Java
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started