Absolute Java (6th Edition)
Absolute Java (6th Edition)
6th Edition
ISBN: 9780134041674
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 16, Problem 4PP

The text files boynames. txt and girlnames. txt, which are included in the source code for this book, contain lists of the 1,000 most popular boy and girl names in the United States for the year 2005, as compiled by the Social Security Administration.

These are blank-delimited files where the most popular name is listed first, the second most popular name is listed second, and so on to the 1,000th most popular name, which is listed last. Each line consists of the first name followed by a blank space followed by the number of registered births in the year using that name. For example, the girlnames . txt file begins with

Emily 25494

Emma 22532

This indicates that Emily is the most popular name with 25,494 registered namings, Emma is the second most popular with 22,532, and so on.

Write a program that determines how many names are on both the boys' and the girls' list. Use the following algorithm:

Read each girl name as a String, ignoring the number of namings, and add it to the same HashSet object.

Read each girl name as a String, ignoring the number of namings, and add it to the same HashSet object. If the name is already in the HashSet, then the add method returns false. If you count the number of false returns, then this gives you the number of common namings.

Add each common name to an ArrayList and output all of the common names from this list before the program exits.

Blurred answer
06:03
Students have asked these similar questions
PYTHONPLEASE ALSO SHARE CODE THROUGH LINK: online-python(dot)com Create a python program that reads the student information from a tab separated values (tsv) file. The python program then must creates a text file that will records the course grades of the students. Each row of the tsv file contains the Last Name, First Name, Midtrm1 score, Midtrm2 score, and the Final score of a student. A sample of the student information is provided in StudentInfoScore.tsv. Assume the number of students is at least 1 and at most 20. The program performs the following tasks: Read the file name of the tsv file from the user. Open the tsv file and read the student information. Compute the average exam score of each student. Assign a letter grade to each student based on the average exam score in the following scale: A: 90 =< x B: 80 =< x < 90 C: 70 =< x < 80 D: 60 =< x < 70 F: x < 60 Compute the average of each exam. Output the last names, first names, exam scores, and letter…
Python Code please Popular Names The 2 data files: boynames.txt and girlnames.txt each contain a list of the 1000 most popular names for boys and girls in the U.S. for the year 2021 as compiled by the Social Security Administration. These are blank-delimited files where the names are listed in order of popularity (the most popular name is listed first and the 1000th most popular name listed last). Each line consists of the name followed by a blank space and then the number of registered births using that name in the year. Write a program that reads both the girl's and boy's files into memory using a dictionary. The key should be the name and value should be a user defined object which is the count and rank of the name. Allow the user to input a name, the program should find the name (regardless of user's input letter case - i.e. upper or lower case) in the dictionary and print out the rank and the number of names. If the name isn't a key in the dictionary, then the program should…
Two data files are required to evaluate a multiple-choice examination. The first file (booklet.dat) (memo) contains the correct answers. The total number of questions is 50. A sample file is given below: ACBAADDBCBDDAACDBACCABDCABCCBDDABCACABABABCBDBAABD The second file (answer.dat) contains the students’ answers. Each line has one student record that contains the following information: The student’s answers (a total of 50 answers): each answer can be A, B, C, D or * (to represent no answer). There are no blanks between answers.  Student ID  Student name A sample file is given below: AACCBDBC*DBCBDAAABDBCBDBAA*BCBDD*BABDBCDAABDCBDBDA 6555 MAHMUT CBBDBC*BDBDBDBABABABBBBBABBABBBBD*BBBCBBDBABBBDC** 6448 SINAN ACB*ADDBCBDDAACDBACCABDCABCCBDDABCACABABABCBDBAABD 6559 CAGIL Write a C++ program that counts the total number of correct answers by each student and outputs this information to another file called report.dat. In this file, the student’s IDs, names and the scores must be given. Each…

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C - File I/O; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=cEfuwpbGi1k;License: Standard YouTube License, CC-BY
file handling functions in c | fprintf, fscanf, fread, fwrite |; Author: Education 4u;https://www.youtube.com/watch?v=aqeXS1bJihA;License: Standard Youtube License