The
goal is to build the infrastructure for on-line quizzes or surveys. A quiz or
survey contains a number of questions. There are three types of questions:
select one multiple choice, select many multiple choice and short answer. A
select one multiple choice question has text for the question and a list of
possible answers. Only one of the answers can be selected at a time. For example:
What
is your favorite color?
Red
Black
Yellow
White
A select many multiple choice question has the text for the question and a list
of possible answers, just like select one multiple choice. However any number
of the answers can be selected at the same time. A short answer question has
text for the question. When the question is displayed there is an area for a
user to enter a short answer. For example:
What
is your name?
_______________
A
survey or a quiz has a name and a list of questions. The questions are numbered
1 through n. Survey/quiz are to be displayed in html. Each Survey/quiz is an
html form. Here is a sample quiz. The sample quiz contains only three
questions, one of each type. This is to illustrate each type of question. Any
number of questions of each type could appear in a quiz/survey.
----
Pop
Quiz
1.
What is your favorite color? Select one.
Red
Black
Yellow
White
2.
What is your favorite color? Select all that apply.
Red
Black
Yellow
White
3.
What is your name?
Submit ---- The
html source for the quiz is:
---- <html
>
<
input name =
"Name"
value
=
"Pop
Quiz"
type
=
"hidden"
></
input >
1.
What is your favorite color? Select one.
<
br ></ br >
<
input name =
"1"
value
=
"Red"
type
=
"radio"
></
input > Red
<
br ></ br >
<
input name =
"1"
value
=
"Black"
type
=
"radio"
></
input > Black
<
br ></ br >
<
input name =
"1"
value
=
"Yellow"
type
=
"radio"
></
input > Yellow
<
br ></ br >
<
input name =
"1"
value
=
"White"
type
=
"radio"
></
input > White
<
br ></ br >2. What colors do you like? Select all that apply.
<
br ></ br >
<
input name =
"2"
value
=
"true"
type
=
"checkbox"
></
input > Red
<
br ></ br >
<
input name =
"2"
value
=
"true"
type
=
"checkbox"
></
input > Black
<
br ></ br >
<
input name =
"2"
value
=
"true"
type
=
"checkbox"
></
input > Yellow
<
br ></ br >
<
input name =
"2"
value
=
"true"
type
=
"checkbox"
></
input > White
<
br ></ br >3. What is your name?.
<
input name =
"3"
value
=
""
type
=
"text"
></
input >
<
input value =
"Submit"
type
=
"submit"
></
input >
</
form >
</
body >
</
html >
---- People
that create the questions for quizzes and survey do not want to create the html
by hand. So they will create a string that contains the needed information.
Here is the string for the above quiz.
---- n=Pop
Quiz
q=-What
is your favorite color?
a=Red a=Black a=Yellow a=White q=+What
colors do you like?
a=Red a=Black a=Yellow a=White q=?What
is your name?
----
The
first letter of the line indicates what the line contains
“n”
indicates the line contains the name of the quiz/survey. It is the first line
and occurs only once.
“q”
indicates the line contains the text of a question. The first character after
the “=” indicates the type of the question. A “-“
indicates a select one multiple choice question. A “+” indicates a
select many multiple choice question. A “?” indicates a short
answer question.
“a”
indicates the line contains the text of a possible answer to a question.
Note
that the questions do not contain the number for the question or the
“Select one.” or “Select all that apply” text.
For
this assignment you need to be able take the input string describing a
quiz/survey and produce the html for the quiz/survey.
Grading
10%
of the grade will be on formatting, following Smalltalk naming conventions and
using reasonable names
10%
of the grade will be on unit tests for your code
10%
of grade will be on the structure of your code
The
remainder of the grade will be on meeting the requirements of the assignment.
Future
Possible Requirements
Handle
result of people submitting a filled out quiz/survey and present a summary of
the results of all the returned quizzes/surveys.
For
a quiz keep track of each persons quiz answers and return the score for the quiz.