Question
C++ Assignment Against all bureaucratic stereotypes, the Social Security Administration provides a neat web site showing the distribution of names chosen for children over the
C++ Assignment Against all bureaucratic stereotypes, the Social Security Administration provides a neat web site showing the distribution of names chosen for children over the last 100 years in the United States ( http://www.ssa.gov/OACT/babynames/ ). The Social Security Administration provides data that shows the 1000 most popular boy and girl names for children at 10 year intervals. The data can be boiled down to a single text file that looks something like this: NamesData.txt . . . Sam 58 69 99 131 168 236 278 380 467 408 466 997 Samantha 0 0 0 0 0 0 272 107 26 5 7 63 Samara 0 0 0 0 0 0 0 0 0 0 886 0 Samir 0 0 0 0 0 0 0 0 920 0 798 0 Sammie 537 545 351 325 333 396 565 772 930 0 0 0 Sammy 0 887 544 299 202 262 321 395 575 639 755 0 Samson 0 0 0 0 0 0 0 0 0 0 915 0 Samuel 31 41 46 60 61 71 83 61 52 35 28 32 Sandi 0 0 0 0 704 864 621 695 0 0 0 0 Sandra 0 942 606 50 6 . . . 12 11 39 94 168 257 962 Each line of the file begins with the name, followed by the rank of that name in each of the 11 decades since 1900, counting the current one: 1900, 1910, 1920, and so on up to 2010. A rank of 1 indicates the most popular name that year, while a rank of 997 indicates a name that is not very popular. A 0 entry means the name did not appear in the top 1000 names for that year and therefore indicates a name that is even less popular. The elements on each line are separated from each other by a single space. The lines happen to be in alphabetical order, but nothing in the assignment depends on that fact. As you can see from the small excerpt from the file, the name Sam was #58 in the first decade of the 1900s and has since dropped to the bottom of the Top 1000 list. Samantha popped on the scene in the 1960s (possibly because the show Bewitched, which had a main character named Samantha, ran on television during those years) and was extremely popular ten years ago, but is now just very popular. Samir didn't even appear on the Top 1000 list until the 1980's. The database counts children born in the United States, so trends in particular names tend to reflect the evolution of ethnic communities over the years. You selected Sam 1900*-58 1910*-69 1920*-99 1930**-131 1940***-168 1950****-236 1960*****-278 1970*******-380 1980*********-467 1990********-408 2000*********-466 2010*******************-997 The goal of this assignment is to create a program that graphs these names over time. In the sample out for a single name above, the user has just chose Sam as the name to display. Whenever the user enters a name, the NameSurfer program creates a new bar graph showing how that name has fared over the decades. (Note that the program is not case sensitive to the names that the user types into the Name. So, the user could enter Samantha, SAMANTHA, samantha or even sAmAnThA and the program would display the graph for the name "Samantha".) To give you more experience working with classes that interact with one another, the NameSurfer application as a whole is broken down into several class files, as follows: NameSurferThis is the main program class that ties together the It is responsible for creating the other objects and for responding to the buttons at the bottom of the window, but only to the point of redirecting those events to the objects represented by the other classes. NameSurferEntryThis class ties together all the information for a particular Given a NameSurferEntry object, you can find out what name it corresponds to and what its popularity rank was in each decade. NameSurferDataBaseThis class keeps track of all the information stored in the data files, but is completely separate from the user It is responsible for reading in the data and for locating the data associated with a particular mplement the NameSurferEntry class The NameSurferEntry class encapsulates the information pertaining to one name in the database. That information consists of two parts: The name itself, such as "Sam" or "Samantha" A vector of 12 values indicating the rank of that name in each of the decades from 1900 to 2010, The class definition begins with a constructor that creates an entry from the line of data that appears in the NamesData.txt file. For example, the entry for Sam looks like this: Sam 58 69 99 131 168 236 278 380 467 408 466 997 class NameSurferEntry { //Overload your Boolean operators //Do a Friend Overload for cout<< public: NameSurferEntry(string line); string getName(); int getRank(int decade); private: Vector year; string name; }; Your program will start by opening and reading the file into the linked list. The n it will produce the following menu: 1:Enter a name to be searched. 2:Enter a year 3:Exit When the user selects a year, your program must say You must ask the following questions Enter how many Names you want to compare: 2 Enter Name 1: Sam Enter Name 2: Samantha You selected the decade 1960 Sam *****-278 Samatha *****-27 Implement the NameSurferDataBase class The next step in the process is to implement the NameSurferDataBase class, which contains two public entries: A constructor that takes the name of a data file and uses that to read in the entire set of data from the file into internal data structures that allow the class to keep track of all the records as a A findEntry method that takes a name, looks it up in the stored database (note that your program should not be case sensitive regarding the name), and returns the NameSurferEntry for that name, or null if that name does not class NameSurferDataBase { public: NameSurferDataBase(string filename); void getNameData(string filename); NameSurferEntry findEntry(string name); private: Linked_List database; };
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