Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CS HELP Use sets to solve this problem package log; import java.io.IOException; import java.io.Reader; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class LogParser { /**

CS HELP

Use sets to solve this problem

package log;

import java.io.IOException;

import java.io.Reader;

import java.util.ArrayList;

import java.util.List;

import java.util.Scanner;

public class LogParser {

/**

* Returns a list of SuspectEntries corresponding to the CSV data supplied by the given Reader.

*

* The data contains one or more lines of the format:

*

* Marc,413-545-3061,1234567890

*

* representing a name, phone number, and passport number.

*

* @param r an open Reader object

* @return a list of SuspectEntries

* @throws IOException

*/

public static List parseLog(Reader r) throws IOException {

}

/**

* Returns a sorted list of SuspectEntries whose passport numbers are common to all

* of the supplied entryLists.

*

* The list is sorted lexicographically by passport number, breaking ties by name

* and then by phone number.

*

* @param list a list of lists of SuspectEntries

* @return a sorted list of SuspectEntries whose passport numbers are common to all

* of the supplied entryLists

*/

public static List findCommonEntries(List> list) {

}

}

package log;

public class SuspectEntry {

private String name;

private String phoneNumber;

private String passportNumber;

private String cardNumber;

public SuspectEntry(String name, String phoneNumber, String passportNumber, String cardNumber) {

this.name = name;

this.phoneNumber = phoneNumber;

this.passportNumber = passportNumber;

this.cardNumber=cardNumber;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String getPhoneNumber() {

return phoneNumber;

}

public void setPhoneNumber(String phoneNumber) {

this.phoneNumber = phoneNumber;

}

public String getPassportNumber() {

return passportNumber;

}

public void setPassportNumber(String passportNumber) {

this.passportNumber = passportNumber;

}

public String getCardNumber() {

return cardNumber;

}

public void setCardNumber(String cardNumber) {

this.cardNumber=cardNumber;

}

public String toString() {

return "name='" + name + '\'' +

", phoneNumber='" + phoneNumber + '\'' +

", passportNumber='" + passportNumber+'\''+", cardNumber='"+cardNumber;

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sybase Database Administrators Handbook

Authors: Brian Hitchcock

1st Edition

0133574776, 978-0133574777

More Books

Students also viewed these Databases questions

Question

Create a workflow analysis.

Answered: 1 week ago