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

Assignment 6

Due Saturday Dec. 20 10:30 am. You can turn it in before then.

Survey & Quizzes Continued

There are two changes to the specification given in assignment 5. The first modification is that questions can be added to an existing quiz or survey. That is when a quiz/survey is submitted and there is already a quiz/survey with the same name, the new questions are added to the existing quiz/survey.

The second modification involves the html generated for the select many multiple choice questions. For the question:

q=+What colors do you like?

The html should be:

   <br></br>2. What colors do you like? Select all that apply. 
   <input name ="2" value ="Red" type ="checkbox"></input>&nbsp;Red 
   <input name ="2" value="Black" type="checkbox"></input>&nbsp;Black 
   <input name ="2" value ="Yellow" type ="checkbox"></input>&nbsp;Yellow 
   <input name="2" value ="White" type="checkbox"></input>&nbsp;White 

Entering a Quiz/Survey

A user enters the text for a quiz or survey using an html web page like:

   New Quiz/Survey
      CS 535 Quiz/Survey 
   <hr size="1" noshade>
   <h2 align="center">
      Add a new Quiz/Survey
   <form action="servlet/NewSurvey" method="post">
      <p align="left">
         Select the type:
      <input name="type" value="Quiz" type="radio">
      <input name="type" value="Survey" type="radio">
         Enter the quiz/survey text
      <textarea name="definition" rows="20" cols="80">
      <input type="submit">

Here is a doPost:response: method that echos the submitted quiz/survey information.

doPost: aRequest response: aResponse 
   | surveyString surveyType |
   surveyString := aRequest anyFormValueAt: 'definition'.
   surveyType := aRequest anyFormValueAt: 'type'.
   "Here we can do anything we want.
   Just return it for demonstration"
      write: '<html><body>You entered: <pre>';
      write: surveyString;
      write: '</pre><BR>Type: ';
      write: surveyType;
      write: '</body></html>'

Some notes about submitting a quiz/survey.

1. If the above static web page is served from the VW web server we can use the relative url like:
 form action="servlet/NewSurvey" 
If the static web page is served via another means then we need to use the full url like:
form action=

2. In the surveyString in the above doPost:response: method the lines are separated by a carriage return (Character cr) and then a line feed (Character lf).

3. If a quiz/survey of a given name already exists then the questions are added to the existing quiz/survey.

New Functionality

When a user submits a survey or quiz it needs to be saved for later use. The url:

returns a web page that lists all the surveys and quizzes by their title. When a user clicks on the title of a survey/quiz it should display a web page with the survey/quiz. Below is a sample web page that lists two surveys.

         <a href="DisplaySurvey?name=Computers">
      <a href="DisplaySurvey?name=Food Survey">
         Food Survey</a>

When a user clicks on one of the surveys they will get the html page for the survey. They can answer the questions and submit the filled out survey. They will then get a page displaying the number of times each answer in the survey was selected. These results are cumulative. That is they see the number of times each answer was selected by all people up to that point.

Quizzes and Students working in Pairs

If you wish to work with one other student on this assignment you may do so, but will need to also add the following functionality.

When a quiz is entered answers are marked as to which answer is correct. For example:

n=Math Quiz
q=-What is the square root of 4
The “^” indicates which answer is correct. It is possible that more than one answer is correct for a given problem. In that case more than one answer will be marked with the “^”. Note that this means that the text of an answer cannot start with an “^”. Of course when displaying a quiz for someone to take, the correct answers should not be indicated. Short answer questions will not be used in quizzes. When a user submits a filled out quiz, they get a page giving them their score on the quiz and lists the questions they got right.


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

20% of grade will be on the structure of your code

The remainder of the grade will be on meeting the requirements of the assignment.

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 02-Dec-03