Question
Hi I need help on how to do the following Graph progblem . Modify the BabyNames.java so it will do the following: The names.txt file
Hi I need help on how to do the following Graph progblem.
Modify the BabyNames.java so it will do the following:
The names.txt file contains data about popular baby names over the last 80 years in the United States (http://www.ssa.gov/OACT/babynames). Every 10 years, the data gives the 1000 most popular boy names and girl names for children born in the US. The data can be summarized in the following format:
...
Sam 99 131 168 236 278 380 467 408 466
Samantha 0 0 0 0 272 107 26 5 7
Samara 0 0 0 0 0 0 0 0 886
Samir 0 0 0 0 0 0 920 0 798
...
Each line has a name followed by the rank of that name in 1920, 1930, , 2000 (9 numbers). A rank of 1 was the most popular name for that decade, while a rank of 907 was not that popular. A 0 means that the name was out of the 1000 popular names for that decade.
Your program will give an introduction and then prompt the user for a name. Then it will read through the data file searching for that name. The search should be case-insensitive, meaning that you should find the name even if the file and the user use capital letters in different places. As an extreme example, SaMueL would match sAMUel.
If your program finds the name, it should print out the statistics for that name onto screen. You are to reproduce this format exactly:
** Popularity of a baby name since year 1920 **
name? ada
1920: 154
1930: 196
1940: 244
1950: 331
1960: 445
1970: 627
1980: 962
1990: 0
2000: 0
Then, you need to save the statistics into a result file for that baby name. For the example above, the result file should be named as Ada.txt, which should contain contents in the following format exactly:
Ada, 1920: 154,
1930: 196,
1940: 244,
1950: 331,
1960: 445,
1970: 627,
1980: 962,
1990: 0,
2000: 0
If the name is not in the data file, your program should generate a short message onto screen indicating the name was not found. You are to reproduce this format exactly:
** Popularity of a baby name since year 1920 **
name? kumar
name not found.
In this case, you should not generate the result file.
AFTER you successfully find the name, print out to screen and save to the result file, try drawing a graph for the ranks of that name over time. One example is
You should start prohgram with
import java.util.*;
import java.awt.*;
import java.io.*;
public class BabyNames {
shown below. Of course, you can be creative here. Draming Panel File View Hele 1920 1930|1940|1950 | 1960t 1970 | 1980 | 1950 2000
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