SDSU CS 535 Object-Oriented Programming
Fall Semester, 2003
Assignment 5
    Assignment Index        
© 2003, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 14-Nov-03

Assignment 5
Due November 25

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?


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.


2. What is your favorite color? Select all that apply.


3. What is your name?

Submit
----
The html source for the quiz is:
----
<html >

 < head ></ head >

 < body >

  < form  action = "/survey"  method = "POST" >
<center><b>Pop Quiz</b></center>

   < br ></ br >

   < input  name = "Name"  value = "Pop Quiz"  type = "hidden" ></ input >
1. What is your favorite color? Select one.

   < br ></ br >&nbsp;

   < input  name = "1"  value = "Red"  type = "radio" ></ input >&nbsp;Red

   < br ></ br >&nbsp;

   < input  name = "1"  value = "Black"  type = "radio" ></ input >&nbsp;Black

   < br ></ br >&nbsp;

   < input  name = "1"  value = "Yellow"  type = "radio" ></ input >&nbsp;Yellow

   < br ></ br >&nbsp;

   < input  name = "1"  value = "White"  type = "radio" ></ input >&nbsp;White

   < br ></ br >2. What colors do you like? Select all that apply.

   < br ></ br >&nbsp;

   < input  name = "2"  value = "true"  type = "checkbox" ></ input >&nbsp;Red

   < br ></ br >&nbsp;

   < input  name = "2"  value = "true"  type = "checkbox" ></ input >&nbsp;Black

   < br ></ br >&nbsp;

   < input  name = "2"  value = "true"  type = "checkbox" ></ input >&nbsp;Yellow

   < br ></ br >&nbsp;

   < input  name = "2"  value = "true"  type = "checkbox" ></ input >&nbsp;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.

Copyright ©, All rights reserved.
2003 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.

    visitors since 13-Nov-03