Problem Description Write a JAVA program that will read all words from a passage and store them in BST. The program then will display a menu and perform the following task: Delete a word. If a word exists, update the word frequency otherwise print word not exist.  Search a word. If a word exists, print the word and its frequency otherwise print not exist. Add a new word. If the word is in the passage, update its frequency. Print all words and their frequency in ascending order.   Input The input of this program is a passage. A passage consists of N words and symbols. Symbols that will be considered in the passage are full stop (.), comma (,), question mark (?) and exclamation mark (!). The passage will have M unique words, where the M is less than or equal to N. Followed by the input code and the required data as specified in the sample input-output.   Input  Stay at home, stay safe and stay healthy. Practice social distancing at work and at home. Help reduce the risk of infection and preventing covid19. Together we break the chain of covid19. #kita jaga kita. Hapuskan covid19!. 2 pandemic 44 5   where     the first line is the input text     the second line is number of menu 2 - Delete word     the third line is wrong input number  (44 - out of range input value)     the forth line is number of menu 5 - Exit   Output  Menu: 1. Add new word. 2. Delete word. 3. Search word. 4. Print all words and its frequency. 5. Exit.   Input code: 2 Enter word to be deleted: pandemic The word pandemic is not in the passage.   Menu: 1. Add new word. 2. Delete word. 3. Search word. 4. Print all words and its frequency. 5. Exit.   Input code: 44 Invalid code, Enter code 1-5.   Menu: 1. Add new word. 2. Delete word. 3. Search word. 4. Print all words and its frequency. 5. Exit.   Input code: 5 Bye..

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

Problem Description

Write a JAVA program that will read all words from a passage and store them in BST. The program then will display a menu and perform the following task:

  • Delete a word. If a word exists, update the word frequency otherwise print word not exist. 
  • Search a word. If a word exists, print the word and its frequency otherwise print not exist.
  • Add a new word. If the word is in the passage, update its frequency.
  • Print all words and their frequency in ascending order.

 

Input

The input of this program is a passage. A passage consists of N words and symbols. Symbols that will be considered in the passage are full stop (.), comma (,), question mark (?) and exclamation mark (!). The passage will have M unique words, where the M is less than or equal to N.

Followed by the input code and the required data as specified in the sample input-output.

 

Input 

Stay at home, stay safe and stay healthy. Practice social distancing at work and at home. Help reduce the risk of infection and preventing covid19. Together we break the chain of covid19. #kita jaga kita. Hapuskan covid19!.

2

pandemic

44

5

 

where

    the first line is the input text

    the second line is number of menu 2 - Delete word

    the third line is wrong input number  (44 - out of range input value)

    the forth line is number of menu 5 - Exit

 

Output 


Menu:
1. Add new word.
2. Delete word.
3. Search word.
4. Print all words and its frequency.
5. Exit.

 

Input code: 2
Enter word to be deleted: pandemic
The word pandemic is not in the passage.

 

Menu:
1. Add new word.
2. Delete word.
3. Search word.
4. Print all words and its frequency.
5. Exit.

 

Input code: 44
Invalid code, Enter code 1-5.

 

Menu:
1. Add new word.
2. Delete word.
3. Search word.
4. Print all words and its frequency.
5. Exit.

 

Input code: 5
Bye..

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Structure chart
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