The text file babynames2012.txt, which is included in the source code for this book and is available online from the book’s website, contains a list of the 1000 most popular boy and girl names in the United States for the year 2012 as compiled by the Social Security Administration.
This is a space-delimited file of 1000 entries in which the rank is listed first, followed by the corresponding boy name and girl name. The most popular names are listed first and the least popular names are listed last. For example, the file begins with
1 Jacob Sophia 2 Mason Emma 3 Ethan Isabella |
This indicates that Jacob is the most popular boy name and Sophia is the most popular girl name. Mason is the second most popular boy name and Emma is the second most popular girl name.
Write a
For example, if the user enters the name “Justice,” then the program should output:
Justice is ranked 519 in popularity among boys. Justice is ranked 518 in popularity among girls. |
If the user enters the name “Walter,” then the program should output:
Walter is ranked 376 in popularity among boys. Walter is not ranked among the top 1000 girl names. |
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Problem Solving with C++ (9th Edition)
Additional Engineering Textbook Solutions
C++ How to Program (10th Edition)
Starting Out with C++ from Control Structures to Objects (9th Edition)
Starting Out with Java: From Control Structures through Objects (6th Edition)
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Database Concepts (8th Edition)
Starting Out with Python (4th Edition)
- Load the airline JSON file into a python dictionary, save it to a text file and print the airlines that operated in Boston and SanFrancisco airports during the month of June.arrow_forwardProgramming language: C/C++, Java, Python, or any other advanced programming languages Project Description: the file “IntegerArray.txt” included in this project folder contains all the 100,000 integers between 1 and 100,000 (inclusive) in some order, with no integer repeated. Your task is to compute the number of inversions in the file given, where the i-th row of the file indicates the i-th entry of an array. Because of the large size of this array, you should implement a divide-and-conquer algorithm.arrow_forward#program should be wrote in python with comments please. Write a program that reads the contents of a text file. The program should create a dictio-nary in which the keys are the individual words found in the file and the values are the number of times each word appears. For example, if the word “the” appears 128 times, the dictionary would contain an element with 'the' as the key and 128 as the value. The program should either display the frequency of each word or create a second file containing a list of each word and its frequency.arrow_forward
- Part II: Image Representation An image is an array, or a matrix, of pixels (picture elements) arranged in columns and rows. RGB is one of the models used in color pixels. In a color image, each RGB pixel is an integer number which contains the mixture of red, green and blue colors. In this assignment, you will be provided with an image data file, image.dat. The first line in data file contains the height (rows) and width (columns) of the image. The following lines gives the red, green and blue color integer values for each pixel. The following sample.dat is given as an example: (The given example can be seen on the picture down) According to this input file, the image has 4 rows and 2 columns. The pixel at [0][0] has red value 117, green value 117 and blue value 245. Write a Java program that reads from the given input file and creates an RGB image object with the given width and height. Then, it'll read red, green and blue color values for each pixel from data file, and calculate RGB…arrow_forwardIn c++ languagearrow_forwardAssume that grade records are dictionaries that always contain three keys: "Assi gnments", "Midterm“, and "Final". An example of such a record might be: {"Assignments" :[99, 98, 100, 100, 80], "Midterm" :95, "Final" : 90} Note that the "Assignments" key is associated with a list, rather than a single integer; this is because there were 5 assignment grades in the class. All numeric values will be in the range 0 to 100 (i.e. they are percent ages). Also assume that dictionary_students is a dictionary in which the keys are student names and the values are grade records. Define a function called final_grades () that accepts dictionary_students as its only parameter. The function should add a new key-value pair to each grade record in dictionary_students. The key for this pair should always the be word "Grade", and the value should be the student's final overall grade in the class. The final grade can be calculated according to the following information from the course syllabus: • Each…arrow_forward
- This is a python File Create a program that presents a menu with these options: Add product Sort by quantity (low to high) Print Inventory Quit Read the initial product information from a text file. Remember to ask the user to enter the filename & make sure it exists! The program should NOT product an error if the file isn’t there! Store the product information into a DICTIONARY called prodDict. The dictionary should map the productID (the key for the dictionary) to a LIST that contains description, unitPrice, and quantity. The text file will be structured as shown below, where each line contains the product id, product description, unitPrice and quantity.NOTE: Each entry on the line is separated by a comma and a space. Example textfile: 111, arm chair, 99.99, 5444, desk, 10, 40777, lamp, 20, 5333, credenza, 50.98., 20222,bassinet , 5.59, 10 Example of the empDict after the information shown has been readd and stored:{ 111: [“George Gray”, 10, 40], 222: [“Amy Abrahmson”,…arrow_forwardCode in C++ language Included is an input file that contains data for every Superbowl MVP winner, their position, and the team for which they played.Here is a sample of the data in the file. I removed the top row to make importation easier. Import this file into a 2D string array with 55 rows and6 columns. Use two array indexes for first and last name. Superbowl Year Winner MVP PositionI 1967 Packers Bart Starr QBII 1968 Packers Bart Starr QBIII 1969 Jets Joe Namath QBIV 1970 Chiefs Len Dawson QBV 1971 Colts Chuck Howley LBVI 1972 Cowboys Roger Staubach QBVII 1973 Dolphins Jake Scott SVIII 1974 Dolphins Larry Csonka FBIX 1975 Steelers Franco Harris RBX 1976 Steelers Lynn Swann WRarrow_forwardThis is Python - Chapter 9 with pseudocode Write a program that uses a dictionary to record five courses and their current grades. Start with an empty dictionary and then use a loop and keyboard input to specify the course names as keys and numeric grades as values. After all five courses have been entered, use another loop and the items() method to display the course names and grades in a table, nicely formatted as you see fit with an f-string. This second loop should also determine the course name and grade of the course with the lowest grade. Report this course name and grade when the loop ends and then delete (drop) that course from the dictionary. If math is one of the courses, add 3 points to the math grade. Otherwise, report that math is not in the dictionary. In one final loop that doesn't use the items() method, display the updated courses and grades again in a table. This final loop should also determine the total of all grades so the term average accurate to one decimal…arrow_forward
- Write a program to create two files with the names file4.txt and file4a.txt two 10 element int arrays with the names arrfile4 and arrfile4a; these arrays are to have different values write the contents of arrfile4 to file4.txt write the contents of arrfile4a to file4a.txt Use a for loop to modify each element of arrfile4 by 2 Use a for loop to modify each element of arrfile4a by 3 write the new contents of arrfile4 to file4by2.txt write the new contents of arrfile4a to file4aby3.txtarrow_forwardThe elements in the set cannot be accessed using indexing and slicing, choose whether this statement is true or false. a. True b. False Clear my choicearrow_forwardHospital Directory. Develop a directory look-up program for Community General Hospital. Create multiple 1D arrays, predefined with the following information (table below). The ID column serves as a common index; the rest of the columns should be stored in individual arrays of the appropriate data type (especially important for the last column!).You will then use a loop to create a menu that repeatedly gives the user the following choices: List all employee records (in order) Display an employee record by ID◦ The user should enter a valid ID. If the employee exists, print out their information. Otherwise, tell the user that it is an invalid ID Display an employee record by last name◦ The user should enter a valid last name. If employee(s) exist, print out their information. Otherwise, tell the user that there are no records. Quit Sample Output:[Community General Hospital Directory]1) List all employees2) Search employee records by ID3) Search employee records by Last Name4)…arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning