I need to write a Java ArrayList program called Search.java that counts the names of people that were interviewed from a standard input stream. The program reads people's names from the standard input stream and from time to time prints a sorted portion of the list of names. All the names in the input are given in the order in which they were found and interviewed. You can imagine a unique timestamp associated with each interview. The names are not necessarily unique (many of the people have the same name). Interspersed in the standard input stream are queries that begin with the question mark character. Queries ask for an alphabetical list of names to be printed to the standard output stream. The list depends only on the names up to that point in the input stream and does include any people's names that appear in the input stream after the query. The list does not contain all the names of the previous interviews, but only a selection of them. A query provides the names of two people, say A and B. The response to the query drops interviews performed before the first named A and all the interviews performed after

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I need to write a Java ArrayList program called Search.java that counts the names of people that were interviewed from a standard input stream.

The program reads people's names from the standard input stream and from time to time prints a sorted portion of the list of names. All the names in the input are given in the order in which they were found and interviewed. You can imagine a unique timestamp associated with each interview. The names are not necessarily unique (many of the people have the same name). Interspersed in the standard input stream are queries that begin with the question mark character. Queries ask for an alphabetical list of names to be printed to the standard output stream. The list depends only on the names up to that point in the input stream and does include any people's names that appear in the input stream after the query.

The list does not contain all the names of the previous interviews, but only a selection of them. A query provides the names of two people, say A and B. The response to the query drops interviews performed before the first named A and all the interviews performed after the last one named B. In the response, the names are to be in alphabetical order and are to be numbered 1, 2, and so on in the standard output stream.

In alphabetical or dictionary order (unlike lexicographic order), case of a letter is considered only after the letter itself: b < B < c; and diacritics are likewise secondardy characteristics: u < ü < v

Sample input and output is shown below 

Input And Output

Read all input from the standard input stream. Write all output to the standard output stream. peoples names do not contain white space. For each query a numbered list is printed, unless one or the other or both people are not found in the previous input. In which case, print the line "Not found".

In the case that both names are found, but the reponse is empty, print the line "Empty list".

 

Input

A_Smith ?

A_Smith

Hugh_Smith ?

Manfred_Smith

Hugh_Smith

Manfred_Smith ?

Manfred_Smith

Hugh_Smith

Hugh_Smith ?

Manfred_Smith

Hugh_Smith ?

Hugh_Smith

Manfred_Smith ?

Hugh_Smith

Hugh_Smith

Output

Not found

Not found

Not found

1: Hugh_Smith

2: Manfred_Smith

Empty List

1: Hugh_Smith

 

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Arrays
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education