Project 4: Exam Scoring System

Due Date: April 12/13

 

Introduction:

This program is supposed to generate a numerical score and a letter grade for students based on their answers for an exam. All questions on the exam are multiple choice and the answer is one from the set {A, B, C, D}. Each question has just one correct answer. There are exactly 20 questions on the exam.

Also you will

 

Program details:

Your program should have atleast one class called ExamScore The method required in this class is a main method. You will decide and accordingly implement other methods, classes, and their interfaces. The program should read the student answers from an input file called students.txt. The input file comprises of the following lines:

 

 Input file Format:

 

  1. The first line contains the answer key in terms of 'A', 'B', 'C', and 'D' characters. An example of this line is given below.

ABCABDCCAABDCDCABBDA

Note: There are exactly 20 characters in the above string indicating answers to 20 questions.

 

  1. The next line contain a student ID followed by the character '|' and then the student responses. An example of this is given below.

123456789|ABC BDCCBABDC CABCDA

  1. There could be empty spaces within the answer characters indicating that the student did not answer all the questions. In the above example, the student did not answer questions 4 and 14.
  2. The number of students in the input file is not fixed. Assume that there will be atleast one student line.
  3. Each correct answer is worth 5 points,  and the incorrect or blank answers are worth 0 points. Your program should compare the student responses to the key provided and generate an aggregate score for the exam.

 

Output file Format: 

 

The output file should be named scores.txt and contain the following information:

  1. The first line printed out should be your name. The second line should be the string 'Exam scoring program'. An empty line should follow these two lines.
  2. After that, each line should contain the student ID followed by the exam score and the exam grade. The exam grade is a letter grade based on the following scale:

93.00 - 100.00 A

90.00 - 92.99 A-

87.00 - 89.99 B+

83.00 - 86.99 B

80.00 - 82.99 B-

77.00 - 79.99 C+

73.00 - 76.99 C

70.00 - 72.99 C-

67.00 - 69.99 D+    

63.00 - 66.99 D

60.00 - 62.99 D-

    0 - 59.99 F

 

An example line is shown below:

123456789 94.00 A

 

  1. The last line in the output should printout average score for all the students.

 

An example is shown below:

                                Average score: 75.50

 

    4.    Another important thing to note is that the scores should be printed in sorted order (from lowest to highest).

            For e.g.: Three students received grades

            123456789 94.00 A

            234567891 86.00 B

            345678910 85.00 B

 

            The output should be in the order

                 

            345678910 85.00 B

            234567891 86.00 B

            123456789 94.00 A

         

Hints

  1. Refer to the Java API at http://java.sun.com/j2se/1.4.2/docs/api/ whenever you need to get more information about particular classes.
  2. If  you read in the student responses as a string, use the charAt() method of the String class to extract individual answers from the String.
  3. Another class of interest will be StringTokenizer.
  4. Declare your exam score variables to be of type double.
  5. Make sure to format the exam scores so that they contain exactly two numbers after the decimal point.

 

Programming Standards

 

Make sure you use javadoc to comment your code.

You'll be expected to observe good programming and documentation standards. You will be expected to follow these standards and others in all of your later programs. Some, specifics include:

 

Testing

You should test your program within the BlueJ environment to make sure that you implemented all the above requirements correctly. Later, you will be provided with test files to test your program with. You should be certain that your program produces the output given above when you use the given input file and the sample test files provided on the course web site. However, verifying that your program produces correct results on a few test cases does not constitute a satisfactory testing regimen. You should make up and try additional input files as well; of course, you'll have to determine what the correct output would be. Your program for this project is a stand-alone program. No other program will invoke its methods.

 

 

Submitting your Program

More information on how to submit your program will be provided in short time.

 

Pledge

Every program submission for this class must include an Honor Code pledge. Specifically, you must always include the following pledge statement in the header comment for your program:

 

/****************************************************************

*

* On my honor:

*

* - I have not discussed the Java language code in my program

* with anyone other than my instructor or the teaching assistants

* assigned to this course.

*

* - I have not used Java language code obtained from another

* student, or any other unauthorized source, either modified or

* unmodified.

*

* - If any Java language code or documentation used in my program

* was obtained from another source, such as a text book or course

* notes, that has been clearly noted with a proper citation in

* the comments of my program.

*

* - I have not designed this program in such a way as to defeat

* or interfere with the normal operation of the Curator System.

*

* Your Name

* Your PID

***************************************************************/

 

Failure to include this pledge in a submission is a violation of the Honor Code.