CS 230 Fall 2004                                            Assignment 12 – Structures (and files and arrays, oh my)                                             100 points

Assigned: 11/30/2004

Due: 12/09/2004 at the start of class. This means that there are two labs in which to work on this assignment. But the second one is the day before the due date, so don’t forget about the assignment in between labs.

 

Pre-Lab (Do Before Lab):  Bring a new disk. Plan out tasks, objects, and events needed for program. Plan out major pseudocode

 

Main Assignment:

E-Vote Inc is revising their program to cash in on the electronic voting era.  Your program (though still simplified) has some major improvements over your previous version – 1) secure access – voters must know their voter id and password in order to vote (no just selecting off a list) and 2) you can see a summary of results – with number of votes for each candidate and displaying the winner. Your program still only deals with voting for one office. The program should get from a file (voters.txt) a list of voter Ids, voter names, and passwords and put them in an array of voters. The voters structure should also have a Boolean indicating whether the voter has voted yet (which should start out as false). The program should also get from another file (candidates.txt) a list of candidates and put them in an array of candidates, as well as a list box or combo box. The candidate structure should also have a number of votes received member (which should start out as zero). When the user types in a voter ID and password, it should be checked to see if it is a valid voter ID/password combination and whether that voter has already voted or not. If there is a problem, a message should be displayed. If everything is ok, their information  (name and ID) should be displayed in read-only text boxes or in labels. When a user then selects the candidate from the combo box (or list box) AND selects a “Vote” button, acknowledge the vote, write the vote (voterId, name and candidate selected) to a comma-delimited text file for later auditing (add it to those already in the file), update the number of votes received for the appropriate candidate and mark the voter as having voted.  Do NOT allow somebody to vote if they have signed in AND picked a candidate. (DO NOT have the vote recorded immediately upon selection in the combo box in case of an inadvertent click). Provide the vote capability, a summary results capability and an exit capability.

 

Hand in:

 

Miscellaneous:

·        MAKE SURE YOUR PROGRAM WORKS!

·        Put YOUR NAME, and e-mail address in comments at the beginning of the program.

·        You MUST include comments that explain your program in order to get full credit.

·        Remember to use meaningful variable names, and indent to show the structure of the program (VB usually does this correctly).

·        Try to use good user interface design. Make clear what user needs to do and what the answers mean.