Write an application that accepts up to 20 Strings, or fewer if the user enters the terminating value ZZZ. Store each String in one of two lists: 1. one list for short Strings that are 10 characters or fewer. 2. and another list for long Strings that are 11 characters or more. After data entry is complete, prompt the user to enter which type of String list to display, either $ for short or L for long and then output the correct list. For this exercise, you can assume that if the user does not request the list of short strings, the user wants the list of long strings. If a requested list has no Strings output The list is empty. Prompt the user continuously until a sentinel value, ZZZ, is entered to quit the program. An example of the program is shown below. Enter a string or ZZZ to quit >> Green Enter a string or ZZZ to quit >> Green eggs Enter a string or ZZZ to quit >> Green eggs and ham Enter a string or ZZZ to quit >> I do not like green eggs and ham Enter a string or ZZZ to quit >> ZZZ Do you want to see the list of short strings or the list of long strings? Please enter S or L or ZZZ to quit >> S Green Green eggs Do you want to see the list of short strings or the list of long strings? Please enter S or L or ZZZ to quit >> L Green eggs and ham I do not like green eggs and ham Do you want to see the list of short strings or the list of long strings? Please enter S or L or ZZZ to quit >> ZZZ 1 import java.util.*; 2 public class CategorizeStrings 3 { 9912 10} 11 public static void main (String[] args) { } // your code here // display()

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

JAVA:

Write an application that accepts up to 20 Strings, or fewer if the user enters the terminating value ZZZ. Store each String in one of two lists:

  1. one list for short Strings that are 10 characters or fewer,
  2. and another list for long Strings that are 11 characters or more.

After data entry is complete, prompt the user to enter which type of String list to display, either S for short or L for long and then output the correct list.

For this exercise, you can assume that if the user does not request the list of short strings, the user wants the list of long strings. If a requested list has no Strings, output The list is empty. Prompt the user continuously until a sentinel value, ZZZ, is entered to quit the program.

An example of the program is shown below:

Enter a string or ZZZ to quit >> Green

Enter a string or ZZZ to quit >> Green eggs

Enter a string or ZZZ to quit >> Green eggs and ham

Enter a string or ZZZ to quit >> I do not like green eggs and ham

Enter a string or ZZZ to quit >> ZZZ

Do you want to see the list of short strings or the list of long strings?

       Please enter S or L or ZZZ to quit >> S

Green

Green eggs

Do you want to see the list of short strings or the list of long strings? 

       Please enter S or L or ZZZ to quit >> L

Green eggs and ham

I do not like green eggs and ham

Do you want to see the list of short strings or the list of long strings?

Please enter S or L or ZZZ to quit >> ZZZ

Instructions
Write an application that accepts up to 20 Strings, or fewer if the user enters the terminating
value ZZZ. Store each String in one of two lists:
1. one list for short Strings that are 10 characters or fewer.
2. and another list for long Strings that are 11 characters or more.
After data entry is complete, prompt the user to enter which type of String list to display, either
$ for short or L for long and then output the correct list.
For this exercise, you can assume that if the user does not request the list of short strings, the user
wants the list of long strings. If a requested list has no Strings, output The list is empty.
Prompt the user continuously until a sentinel value, ZZZ, is entered to quit the program.
An example of the program is shown below.
Enter a string or ZZZ to quit >> Green
Enter a string or ZZZ to quit >> Green eggs
Enter a string or ZZZ to quit >> Green eggs and ham
Enter a string or ZZZ to quit >> I do not like green eggs and ham
Enter a string or ZZZ to quit >> ZZZ
Do you want to see the list of short strings or the list of long strings?
Please enter S or L or ZZZ to quit >> S
Green
Green eggs
Do you want to see the list of short strings or the list of long strings?
Please enter S or L or ZZZ to quit >> L
Green eggs and ham
I do not like green eggs and ham
Do you want to see the list of short strings or the list of long strings?
Please enter S or L or ZZZ to quit >> ZZZ
CategorizeStrings.java +
1 import java.util.*;
2 public class CategorizeStrings
3 {
4
6
7
8
9
10 }
11
12
public static void main (String[] args)
{
}
// your code here
// display()
Transcribed Image Text:Instructions Write an application that accepts up to 20 Strings, or fewer if the user enters the terminating value ZZZ. Store each String in one of two lists: 1. one list for short Strings that are 10 characters or fewer. 2. and another list for long Strings that are 11 characters or more. After data entry is complete, prompt the user to enter which type of String list to display, either $ for short or L for long and then output the correct list. For this exercise, you can assume that if the user does not request the list of short strings, the user wants the list of long strings. If a requested list has no Strings, output The list is empty. Prompt the user continuously until a sentinel value, ZZZ, is entered to quit the program. An example of the program is shown below. Enter a string or ZZZ to quit >> Green Enter a string or ZZZ to quit >> Green eggs Enter a string or ZZZ to quit >> Green eggs and ham Enter a string or ZZZ to quit >> I do not like green eggs and ham Enter a string or ZZZ to quit >> ZZZ Do you want to see the list of short strings or the list of long strings? Please enter S or L or ZZZ to quit >> S Green Green eggs Do you want to see the list of short strings or the list of long strings? Please enter S or L or ZZZ to quit >> L Green eggs and ham I do not like green eggs and ham Do you want to see the list of short strings or the list of long strings? Please enter S or L or ZZZ to quit >> ZZZ CategorizeStrings.java + 1 import java.util.*; 2 public class CategorizeStrings 3 { 4 6 7 8 9 10 } 11 12 public static void main (String[] args) { } // your code here // display()
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Linked List Representation
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