
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
JAVA PROGRAM
Modify this program with further modifications as follows: The test case must pass when uploaded to Hypergrade. THE TEXT FILES ARE LOCATED IN HYPERGRADE and I provided them deom below. Thank you.
BOYNAMES.TXT
Jacob Michael Joshua Matthew Daniel Christopher Andrew Ethan Joseph William Anthony David Alexander Nicholas Ryan Tyler James John Jonathan Noah Brandon Christian Dylan Samuel Benjamin Zachary Nathan Logan Justin Gabriel Jose Austin Kevin Elijah Caleb Robert Thomas Jordan Cameron Jack Hunter Jackson Angel Isaiah Evan Isaac Mason Luke Jason Gavin Jayden Aaron Connor Aiden Aidan Kyle Juan Charles Luis Adam Lucas Brian Eric Adrian Nathaniel Sean Alex Carlos Bryan Ian Owen Jesus Landon Julian Chase Cole Diego Jeremiah Steven Sebastian Xavier Timothy Carter Wyatt Brayden Blake Hayden Devin Cody Richard Seth Dominic Jaden Antonio Miguel Liam Patrick Carson Jesse Tristan Alejandro Henry Victor Trevor Bryce Jake Riley Colin Jared Jeremy Mark Caden Garrett Parker Marcus Vincent Kaleb Kaden Brady Colton Kenneth Joel Oscar Josiah Jorge Cooper Ashton Tanner Eduardo Paul Edward Ivan Preston Maxwell Alan Levi Stephen Grant Nicolas Omar Dakota Alexis George Collin Eli Spencer Gage Max Cristian Ricardo Derek Micah Brody Francisco Nolan Ayden Dalton Shane Peter Damian Jeffrey Brendan Travis Fernando Peyton Conner Andres Javier Giovanni Shawn Braden Cesar Bradley Emmanuel Manuel Edgar Erik Mario Edwin Johnathan Devon Erick Wesley Oliver Trenton Hector Malachi Jalen Raymond Gregory Abraham Elias Leonardo Sergio Donovan Colby Marco Bryson Martin
GirlNames.txt
Emily Madison Emma Olivia Hannah Abigail Isabella Samantha Elizabeth Ashley Alexis Sarah Sophia Alyssa Grace Ava Taylor Brianna Lauren Chloe Natalie Kayla Jessica Anna Victoria Mia Hailey Sydney Jasmine Julia Morgan Destiny Rachel Ella Kaitlyn Megan Katherine Savannah Jennifer Alexandra Allison Haley Maria Kaylee Lily Makayla Brooke Mackenzie Nicole Addison Stephanie Lillian Andrea Zoe Faith Kimberly Madeline Alexa Katelyn Gabriella Gabrielle Trinity Amanda Kylie Mary Paige Riley Jenna Leah Sara Rebecca Michelle Sofia Vanessa Jordan Angelina Caroline Avery Audrey Evelyn Maya Claire Autumn Jocelyn Ariana Nevaeh Arianna Jada Bailey Brooklyn Aaliyah Amber Isabel Danielle Mariah Melanie Sierra Erin Molly Amelia Isabelle Madelyn Melissa Jacqueline Marissa Shelby Angela Leslie Katie Jade Catherine Diana Aubrey Mya Amy Briana Sophie Gabriela Breanna Gianna Kennedy Gracie Peyton Adriana Christina Courtney Daniela Kathryn Lydia Valeria Layla Alexandria Natalia Angel Laura Charlotte Margaret Cheyenne Mikayla Miranda Naomi Kelsey Payton Ana Alicia Jillian Daisy Mckenzie Ashlyn Caitlin Sabrina Summer Ruby Rylee Valerie Skylar Lindsey Kelly Genesis Zoey Eva Sadie Alexia Cassidy Kylee Kendall Jordyn Kate Jayla Karen Tiffany Cassandra Juliana Reagan Caitlyn Giselle Serenity Alondra Lucy Kiara Bianca Crystal Erica Angelica Hope Chelsea Alana Liliana Brittany Camila Makenzie Veronica Lilly Abby Jazmin Adrianna Karina Delaney Ellie Jasmin
Test Case 1
Enter a name to search or type QUIT to exit:\n
AnnabelleENTER
The name 'Annabelle' was not found in either list.\n
Enter a name to search or type QUIT to exit:\n
xavierENTER
The name 'Xavier' was found in popular boy names list (line 81).\n
Enter a name to search or type QUIT to exit:\n
AMANDAENTER
The name 'Amanda' was found in popular girl names list (line 63).\n
Enter a name to search or type QUIT to exit:\n
jOrdAnENTER
The name 'Jordan' was found in both lists: boy names (line 38) and girl names (line 75).\n
Enter a name to search or type QUIT to exit:\n
quitENTER
AnnabelleENTER
The name 'Annabelle' was not found in either list.\n
Enter a name to search or type QUIT to exit:\n
xavierENTER
The name 'Xavier' was found in popular boy names list (line 81).\n
Enter a name to search or type QUIT to exit:\n
AMANDAENTER
The name 'Amanda' was found in popular girl names list (line 63).\n
Enter a name to search or type QUIT to exit:\n
jOrdAnENTER
The name 'Jordan' was found in both lists: boy names (line 38) and girl names (line 75).\n
Enter a name to search or type QUIT to exit:\n
quitENTER

Transcribed Image Text:Test Case 1 Failed
Show what's missing
Enter a name to search or type QUIT to exit: n
Annabelle ENTER
The name 'Annabelle' was not found in either list.\n
Enter a name to search or type QUIT to exit: \n
xavier ENTER
The name 'Xavier' was found in popular boy names list (line 81).\n
Enter a name to search or type
QUIT to exit: n
AMANDA ENTER
The name 'Amanda' was found in popular girl names list (line 63). \n
Enter a name to search or type QUIT to exit: n
jordAn ENTER
The name 'Jordan' was found in both lists: boy names (line 38) and girl names (line 75). \n
Enter a name to search or type QUIT to exit: \n
quit ENTER
Test Case 1 Failed Show what's missing
Screen Shot 2023-10-03 at 5.17.58 PM
Enter a name to search or type QUIT to exit: \n
Annabelle ENTER
The name 'Annabelle' was not found in either list.\n
Enter a name to search or type QUIT to exit: \n
xavier ENTER
The name 'Xavier' was found in popular boy names list (line 81).\n
QUIT to exit: \n
Enter a name to search or type
AMANDA ENTER
The name 'Amanda' was found in
Enter a name to search or type
jordAn ENTER
popular girl names list (line 63).\n
QUIT to exit: \n
The name 'Jordan' was found in
Enter a name to search or type QUIT to exit: \n
quit ENTER
10
Search
both lists: boy names (line 38) and girl names (line 75).\n
![import java.io.*;
import java.util.*;
public class Name Searcher {
private static List<String> loadFileToList (String filename) throws FileNotFoundException
List<String> namesList = new ArrayList<>();
File file = new File (filename);
}
if (!file.exists()) {
throw new FileNotFoundException (filename);
}
try (Scanner scanner = new Scanner (file)) {
while (scanner.hasNextLine()) {
}
String line = scanner.nextLine().trim();
String[] names = line.split("\\s+");
for (String name : names) {
}
namesList.add(name.toLowerCase());
}
}
return namesList;
private static Integer searchNameInList (String name, List<String> namesList) {
int index = namesList.indexOf(name.toLowerCase());
return index == -1 ? null: index + 1;
public static void main(String [] args) {
List<String> boyNames = new ArrayList<>(); // Initialize with an empty list
List<String> girlNames = new ArrayList<>(); // Initialize with an empty list
try {
boyNames
} catch (FileNotFoundException e) {}
=
loadFileToList("BoyNames.txt");
try {
} catch (EileNotFoundExcentian, e) {}
Scanner Scanner = new Scanner (System.in);
QUIT to exit: ");
girlNames =
boxNames);
girlNames);
while (true) {
System.out.println("Enter a name to search or type
11
String input =
}
LoadFileToList("GirlNames.txt");
break;
String capitalizedInput input substring(0,
1).toupperCase() + input.substring(1). takowerCase();
Integer boxIndex = searchNameInList (input,
Integer gilindex
if (jarutegualstonorecase ( "QUIT")) {
}
capitalizedingut +
scanner nextLine().trim();
=
=
if (baxindex == null && girlIndex == null) {
System outrcintln(" "The name
+
was not found in either list.");
searchNameInList(input,
} else if (baxindex != null && girlindex null) {
System.out.println( "The name
+
capitalizedinput + was found in popular boy names list (line
+ boxIndex + ").");
}
scanner clase();
==
} else if (baxindex == null && girlindex != null) {
Skaten out Reintln( "The name " +
caritalizedīneut + was found in popular girl names list (line
" + girltodex + ").");
} else {
System.out.println("The name
+
capitalizedīnput + was found in both lists: boy names
(line "
+ boxindex + ") and girl names (line + girlindex + ").");](https://content.bartleby.com/qna-images/question/ff50a2dd-ef59-4f7a-83c1-bb4350b29730/9d43dfce-aa59-4dc5-9af5-a025b715c201/noc1oio_thumbnail.png)
Transcribed Image Text:import java.io.*;
import java.util.*;
public class Name Searcher {
private static List<String> loadFileToList (String filename) throws FileNotFoundException
List<String> namesList = new ArrayList<>();
File file = new File (filename);
}
if (!file.exists()) {
throw new FileNotFoundException (filename);
}
try (Scanner scanner = new Scanner (file)) {
while (scanner.hasNextLine()) {
}
String line = scanner.nextLine().trim();
String[] names = line.split("\\s+");
for (String name : names) {
}
namesList.add(name.toLowerCase());
}
}
return namesList;
private static Integer searchNameInList (String name, List<String> namesList) {
int index = namesList.indexOf(name.toLowerCase());
return index == -1 ? null: index + 1;
public static void main(String [] args) {
List<String> boyNames = new ArrayList<>(); // Initialize with an empty list
List<String> girlNames = new ArrayList<>(); // Initialize with an empty list
try {
boyNames
} catch (FileNotFoundException e) {}
=
loadFileToList("BoyNames.txt");
try {
} catch (EileNotFoundExcentian, e) {}
Scanner Scanner = new Scanner (System.in);
QUIT to exit: ");
girlNames =
boxNames);
girlNames);
while (true) {
System.out.println("Enter a name to search or type
11
String input =
}
LoadFileToList("GirlNames.txt");
break;
String capitalizedInput input substring(0,
1).toupperCase() + input.substring(1). takowerCase();
Integer boxIndex = searchNameInList (input,
Integer gilindex
if (jarutegualstonorecase ( "QUIT")) {
}
capitalizedingut +
scanner nextLine().trim();
=
=
if (baxindex == null && girlIndex == null) {
System outrcintln(" "The name
+
was not found in either list.");
searchNameInList(input,
} else if (baxindex != null && girlindex null) {
System.out.println( "The name
+
capitalizedinput + was found in popular boy names list (line
+ boxIndex + ").");
}
scanner clase();
==
} else if (baxindex == null && girlindex != null) {
Skaten out Reintln( "The name " +
caritalizedīneut + was found in popular girl names list (line
" + girltodex + ").");
} else {
System.out.println("The name
+
capitalizedīnput + was found in both lists: boy names
(line "
+ boxindex + ") and girl names (line + girlindex + ").");
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 3 images

Knowledge Booster
Similar questions
- Ask the user for a filename. Display the oldest car for every manufacturer from that file. If two cars have the same year, compare based on the VIN. i am having trouble getting my code to work I have this code: import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Scanner; class Car { String manufacturer; String model; int year; String vin; public Car(String manufacturer, String model, int year, String vin) { this.manufacturer = manufacturer; this.model = model; this.year = year; this.vin = vin; } public String getManufacturer() { return manufacturer; } public void setManufacturer(String manufacturer) { this.manufacturer = manufacturer; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public String getVin() { return vin; } public void setVin(String vin) { this.vin = vin; } } public class Demo {…arrow_forwardI'm not sure how to fix my error import csv #This is the classclass ConvertCSVToJSON: def __init__(self, headings, ID, linesFromFile, inputFileName, outputFileName="Project7Output.txt"): self.headings=headings # Headings (row 1 of the file) self.ID=ID self.linesFromFile=linesFromFile # rows2-end of file (EOF) self.outputFileName=outputFileName self.inputFileName=inputFileName def createKeyValuePair(self, key, value): # Think about parameters and how the code will work result="\""+key+"\""+":"+value return result #create a line function/method in class to have access to headings and file. def createLine(self, ID, line): #splits the line into different components lineComponets=line.split(",") dictionary={}#creats a dictionary for the componets for i in range(len(self.heading)): dictionary[self.headings[i]]=lineComponents[i] #adds ID as a keyvalue pair dictionary["ID"]=str(ID) #should convert to json…arrow_forwardAsk the user for a filename. Display the oldest car for every manufacturer from that file. If two cars have the same year, compare based on the VIN. I am having trouble with my code here is my code import java.util.Comparator;import java.io.File;import java.io.FileNotFoundException;import java.util.ArrayList;import java.util.Collections;import java.util.Scanner;class Car {String manufacturer;String model;int year;String vin;public Car(String manufacturer, String model, int year, String vin) {super();this.manufacturer = manufacturer;this.model = model;this.year = year;this.vin = vin;}public String getManufacturer() {return manufacturer;}public void setManufacturer(String manufacturer) {this.manufacturer = manufacturer;}public String getModel() {return model;}public void setModel(String model) {this.model = model;}public int getYear() {return year;}public void setYear(int year) {this.year = year;}public String getVin() {return vin;}public void setVin(String vin) {this.vin = vin;}}class…arrow_forward
- To use any of the prewritten classes besides those in the java.lang package, you must___ a. use the entire path with the class name b. import the class c. import the package of which the class you are using is a part d. use any of these methodsarrow_forwardCreate a program using classes that does the following in the zyLabs developer below. For this lab, you will be working with two different class files. To switch files, look for where it says "Current File" at the top of the developer window. Click the current file name, then select the file you need.(1) Create two files to submit: ItemToPurchase.java - Class definition ShoppingCartPrinter.java - Contains main() method Build the ItemToPurchase class with the following specifications: Private fields String itemName - Initialized in default constructor to "none" int itemPrice - Initialized in default constructor to 0 int itemQuantity - Initialized in default constructor to 0 Default constructor Public member methods (mutators & accessors) setName() & getName() setPrice() & getPrice() setQuantity() & getQuantity() (2) In main(), prompt the user for two items and create two objects of the ItemToPurchase class. Before prompting for the second item, call…arrow_forwardJAVA PPROGRAM ASAP Please Modify this program ASAP BECAUSE IT IS HOMEWORK ASSIGNMENT so it passes all the test cases. It does not pass the test cases when I upload it to Hypergrade. Because RIGHT NOW IT PASSES 0 OUT OF 1 TEST CASES. I have provided the failed the test cases and the inputs as a screenshot. The program must pass the test case when uploaded to Hypergrade. import java.io.File;import java.io.FileNotFoundException;import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); String fileName; System.out.println("Please enter the file name or type QUIT to exit:"); fileName = keyboard.nextLine().trim(); while (!fileName.equalsIgnoreCase("QUIT")) { File file = new File(fileName); if (file.exists()) { int wordCount = countWords(file); System.out.println("Total number of words: " + wordCount + "\n);…arrow_forward
- I have created the following code in java, replit, that's a guessing game. Attached are the classes I've created as separate files. Since I can only upload 2 files, I have written the code in class Main at the very end. Now I need to create and write data into a CSV file, tracking the results of multiple players scores in the Guessing Game. This will require the use of several imported java class including : java.io.File java.io.FileWriter java.util.Scanner java.util.Random java.util.UUID java.io.IOException; And I know nothing about this, so I really need help. You would need to modify all my classes/files accordingly. Also ignore the results.csv file that I tried creating in the pdfs attached. Basically you would need to use the File object along with the Player object, and the properties of the player class is what needs to be written into the CSV. I haven't included any properties of the player class yet (like private UUID id; private String name; private int totalGames; private…arrow_forwardAccording to the below screenshot of an app, build an Android App that has a set of java files that implement an adapter with RecyclerView. The details of the java files you need to create are described below. The first java file should contain a data field which is in this case: Movie_name, Director_name, Production_year. The second java file contains MovieViewHolder. The third java file contains the MovieAdapter which is act as a bridge between the data items and the View inside of RecycleView. The Mainactivity java file will contain some samples data to display.arrow_forwardJava Proram ASAP There is an extra /n in the program in test case 1-3 and after Please re-enter the file name or type QUIT to exit:\n quitENTER in test case 4 there needs to be nothing as shown in the screenshot. The text files are located in Hypergrade. Please modify this code below so it passes the test cases. Also I have the correct test case as a screenshot. import java.io.*;import java.util.Scanner;public class ConvertText { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); System.out.println("Please enter the file name or type QUIT to exit:"); while (true) { String input = sc.next(); if (input.compareTo("QUIT") == 0) { break; } else { String filePath = new File("").getAbsolutePath(); filePath = filePath.concat("/"); filePath = filePath.concat(input); File file = new File(filePath); if…arrow_forward
- Create a program using classes that does the following in the zyLabs developer below. For this lab, you will be working with two different class files. To switch files, look for where it says "Current File" at the top of the developer window. Click the current file name, then select the file you need.(1) Create two files to submit: ItemToPurchase.java - Class definition ShoppingCartPrinter.java - Contains main() method Build the ItemToPurchase class with the following specifications: Private fields String itemName - Initialized in default constructor to "none" int itemPrice - Initialized in default constructor to 0 int itemQuantity - Initialized in default constructor to 0 Default constructor Public member methods (mutators & accessors) setName() & getName() setPrice() & getPrice() setQuantity() & getQuantity() (2) In main(), prompt the user for two items and create two objects of the ItemToPurchase class. Before prompting for the second item, call…arrow_forwardAs a software engineer you are required to produce designs to fulfill user requirements as described in SRS or User Stories. Suppose your software application needs to address the situation as given in respective scenarios (a-e). Your task is to answer the following for each of the given scenarios (a-e): [CLO-3]i. In terms of suitability which design pattern is most appropriate to address each situation? ii. Design/draw generic UML diagram to represent each situation.(a) You are writing a module for a university application that would allow students to apply for online clearance for final transcript issuance. As per policy students’ clearance is done from several offices before request for degree or final transcript could be approved.(b) After graduation, students would like to seek and search admissions in foreign countries. Usually students visit each university-website one by one. Generally they want to know about university ranking, fee, working opportunity, visa requirements etc.…arrow_forward19 We have been dealing with colors as tuples or lists. We could also create a Color class. This would allow us to create new color objects and pass them around. For each method below, write and implementation that matches the content of the method docstring. Recall that individual color channels must have a value between 0 and 255. class Color: """ This class provides a representation of a color """ definit_(self, red, green, blue): Initialize the color with red, green, and blue values 663939arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY