Student Project

                               

MULTIPLE CHOICE 
GRADING PROGRAM
   
ABILITY LEVEL: Intermediate
   
APPROXIMATE COMPLETION TIME: 2 hours
   
OBJECTIVES:

·        Read and parse a sequential data file

   
MATERIALS AND RESOURCES:
  • Visual Basic Software
  • Textbook
  • Basic understanding of algorithms
  • Understanding of looping constructs
  • Understanding of arrays
 
OVERVIEW OF PROJECT:

Create a program to correct and grade a set of multiple choice test results. Read a set of correct answers, from a data file or a text box depending on what you prefer, and compare it with the answers in a data file. The data file will have two fields, separated by a comma, for each student. The first field will contain the student’s name. The second field will contain a set of answers to a multiple-choice test. For each student, compare the answer key answers to the answers from the student’s record. Keep a count of the number of answers from the student’s record that match the answers in the answer key.

For each student, display the student’s name, the number of correct answers, and a letter grade. Calculate the letter grade scale based on information provided by the instructor.

Calculate the average number of correct answers for the class and report it in a separate picture box.

 
PROJECT INSTRUCTIONS:

1.      Create a listbox or other object large enough to display the names, correct count and letter grade of each student.

2.      Create code behind a command button to read the data file and report results

a.      Open the data file

b.      Read the answer key

c.      Read a students record

d.      Compare student’s answers to answer key and count correct answers

e.      Display student’s name, number correct and letter grade

f.        Count number of students and build running total of correct answers

g.      Loop until all student records have been read and processed

3.      Calculate and report average number of correct answers

4.      Create an exit button with the appropriate code to end the program

A complete program should:

·        Read and display all names in the data file

·        Properly score each students set of answers

·        Display the proper grade for each student

·        Calculate and display the average number of correct answers for the whole data file.

·        Exit the program cleanly

 
HINTS:


The program should use a While loop checking on the state of End of File (EOF) to read the data file. The program should count each student as it reads its record.   A variable should be used to add the total correct answers for each student. Use this variable with the student counter variable to calculate the average number of correct answers. Displaying the average as part of the same routine that counts students and adds totals avoids the need for form level variables.

Care must be taken when determining when to open and close the data file. Trying to open a file that is not closed, or trying to read a file that is not yet open or has been opened and closed, are common errors. For this reason, it is recommended that the open and close be done in the same routine. Alternately, the file should be opened once in Form Load and not closed until the exit program routine is called.

Reading data in from a sequential file has many benefits for both students and instructors. Tops among them may be easy reproducibility for testing purposes. Once a set of data is developed and tested, it can be used to prove other programs by comparing results with what is expected. For this reason, as well as to avoid problems caused by faulty data sets, having all students use a common data file is generally desirable.

While loops are a natural tool for reading sequential data files. Review the concept of end of file markers and the EOF built-in method. Be aware that if you want to know how many records you have read, you have to keep track of record numbers yourself. Become aware of how many records are in a test set and you might write programs that use the FOR-NEXT loop which you may find easier but it would not be the best thing to do.

A lower case letter is not equal to an uppercase letter in Visual Basic .NET.  Mixing the case of answers in the data set or using uppercase in the main data set and providing a lower case answer key will demonstrate the need to match cases.  The Lcase and Ucase built-in functions will prove useful here.

List boxes are a convenient tool for displaying variable amounts of data. A result string can be created by concatenation different strings and added to a list box. The vbTab constant can be used to separate strings when building a string to add to a list box.

If  use parallel list boxes to create columns and if the font attributes are not the same, those boxes may have alignment problems. Be sure to clear the right boxes at the right times.


   
PROJECT EXTRAS:

Report the average letter grade as well as the average number of correct answers.

Keep track of the highest and lowest scoring students and report them in a separate box.