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. 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) 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. 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 frist second third fourth right option is 2 qno_2:What comes before second first second third fourth fifth right option is 1 Quiz_2 qno_1:What is liquid water bread smoke right option is 1 qno_3:What is hot icecream candies spices right option is 3
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.
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)
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.
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
- frist
- second
- third
- fourth
right option is 2
qno_2:What comes before second
- first
- second
- third
- fourth
- fifth
right option is 1
Quiz_2
qno_1:What is liquid
- water
- bread
- smoke
right option is 1
qno_3:What is hot
- icecream
- candies
- spices
right option is 3
Step by step
Solved in 4 steps with 1 images