CMSC 210
Spring 2017
Exercise
04/07/2017
Creating an Online Poll
Due: Fri, April 14
beginning of class (1pm)

Assignment:   (worth 30 exercise points)     

For this exercise you will create an online poll.

0)  Create a topic for the poll for which there are at least three options. For example:
  • Which of the Star Trek series was best?
  • Which Big Bang Theory character is your favorite?
  • What is your favorite Dr Seuss book?
  • Best major league pitcher of all time?
  • Best NFL quarterback?
  • Favorite comedy on TV?
  • Snickers vs Milky Way vs Three Musketeers?


1)  (10 points) Create a web page  Poll.html, which gives the user the option of choosing one of the options.  
  • If they chose an option in the poll, it should be recorded on the server and a new webpage should appear saying thank you for your vote.
  • If they chose NO option, the browser should display an error message about "no vote to submit" or the equivalent.  It is up to you whether to use server-side scripting or client-side scripting for this.
A SAMPLE
Sample Poll

Your poll may be radio buttons or it may be a select menu.


2)  (10 points)  Create web page PollAdmin.html which has two buttons:
  • a button which lets the user reset the poll (all votes back to 0)
  • a button which lets the user ask to see the results of the poll so far.   It should tell how many times each of the items has been chosen.  


3)  (10 points)   For this one, you may wish to create a new poll question, if your question above is not suited for this problem.
a)  Create a file  Poll2.html which is similar to above, but ALSO gives the user an option of choosing something besides the given options.     For instance, if you ask for favorite candy bar and give the options:
  • Milky Way
  • Snicker
  • Three Musketeers
 you must give user an option of entering an additional option (eg Almond Joy).

Note:  Future visits to the page must include this additional option for people to choose.  Now, the list would be:
  • Milky Way
  • Snickers
  • Three Musketeers
  • Almond Joy
PLUS an option for this person to add another option to the poll.

NOTE: there are multiple interfaces that can achieve these specifications.

b)  Create PollAdmin2.html  which has two buttons:
  • a button which lets the user reset the poll (all votes back to 0)
  • a button which lets the user ask to see the results of the poll so far.   It should tell how many times each of the items has been chosen. 

Obviously, each of these will need to call a script, appropriately placed on the server.


EXTRA CREDIT:
Each time someone goes to the poll page, the options are listed in a random order (different for each person).

Notes:

  • The submission of this data is NOT secure, but we are not worrying about that right now
  • The means by which we are accessing the file may cause problems if multiple people try to take the poll at the same time.  You do not have to worry about that;  you may assume that only one poll submission at a time is happening.

Handin:

For grading, I will go to the following pages:
  • http://cs.longwood.edu/~youruserid/210/Poll.html
  • http://cs.longwood.edu/~youruserid/210/PollAdmin.html
  • http://cs.longwood.edu/~youruserid/210/Poll2.html
  • http://cs.longwood.edu/~youruserid/210/PollAdmin2.html