Consider you are given a very specialized string with a unique format as: Quiz_(no) # (q.no) : (question statement) $ (option1) , (option 2) , … * (right option number) … \n String starts with Quiz_ (quiz number like 1, 2, … ), then hash #, then question number (like qno_1, qno_2 …), then colon :, then question statement, then dollar $, then options (like option1, option 2 …), then asterisk *, and then right option for the given question statement. If more questions are there for the same quiz, then pattern after hash # is repeated (means every question is separated by # symbole). Each quiz ends with new line (\n), and then new quiz starts with same pattern as before. A sample pattern is given below. Quiz_1# qno_1: What comes next to First $first, second, third, fourth *2 # qno_2: What comes before second $first, second, third, fourth, fifth *1 \nQuiz_2# qno_1: What is liquid $water, bread, smoke *1 # qno_3: What is hot $ice-cream, candies, spices *3 You are required to create a program in JAVA, in such a way that if your program receives any string with this pattern (or format) it should provide output as given below. (Hint: Use split, trim method to do the job)

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

Consider you are given a very specialized string with a unique format as:

Quiz_(no) # (q.no) : (question statement) $ (option1) , (option 2) , … * (right option number) … \n

String starts with Quiz_ (quiz number like 1, 2, … ), then hash #, then question number (like qno_1, qno_2 …), then colon :, then question statement, then dollar $, then options (like option1, option 2 …), then asterisk *, and then right option for the given question statement. If more questions are there for the same quiz, then pattern after hash # is repeated (means every question is separated by # symbole). Each quiz ends with new line (\n), and then new quiz starts with same pattern as before. A sample pattern is given below.

Quiz_1# qno_1: What comes next to First $first, second, third, fourth *2 # qno_2: What comes before second $first, second, third, fourth, fifth *1 \nQuiz_2# qno_1: What is liquid $water, bread, smoke *1 # qno_3: What is hot $ice-cream, candies, spices *3

You are required to create a program in JAVA, in such a way that if your program receives any string with this pattern (or format) it should provide output as given below. (Hint: Use split, trim method to do the job)

Quiz_1
qno_1;What comes next to First
1. frist
2. second
3. third
4. fourth
tight option is 2
qno_2;Wbat comes before second
1. first
2. second
3. third
4. fourth
5. fifth
tight option is 1
Quiz_2
qno_1:What is liquid
1. water
2. bread
3. smoke
right option is 1
qno_3;What is hot
1. icecream
2. candies.
3. spices
tight option is 3
Transcribed Image Text:Quiz_1 qno_1;What comes next to First 1. frist 2. second 3. third 4. fourth tight option is 2 qno_2;Wbat comes before second 1. first 2. second 3. third 4. fourth 5. fifth tight option is 1 Quiz_2 qno_1:What is liquid 1. water 2. bread 3. smoke right option is 1 qno_3;What is hot 1. icecream 2. candies. 3. spices tight option is 3
Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Public key encryption
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
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