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_...


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<br>qno_1;What comes next to First<br>1. frist<br>2. second<br>3. third<br>4. fourth<br>tight option is 2<br>qno_2;Wbat comes before second<br>1. first<br>2. second<br>3. third<br>4. fourth<br>5. fifth<br>tight option is 1<br>Quiz_2<br>qno_1:What is liquid<br>1. water<br>2. bread<br>3. smoke<br>right option is 1<br>qno_3;What is hot<br>1. icecream<br>2. candies.<br>3. spices<br>tight option is 3<br>

Extracted 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
Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here