Lab Assignment 1: Automatic Exam Grader Solution

$30.00

Description

Objectives

Review using one- and two-dimensional arrays Review using basic classes and objects

Review basic file input

Design algorithms using pseudocode

Follow the Software Life Cycle model, with pseudocode and code refinement steps

Problem Specification

Following the Software Life Cycle model presented in class, develop a Java application for automatic grading of multiple-choice exams.

An exam data set will consist of the answer key as well as the students’ answers.

The input file with an exam data set will be as follows:

The first line is the number of multiple-choice questions in the exam

    1. A correct answer for each question is one of the following four choices: a, b, c, or d The second line contains the complete answer key for all questions, all in one line

    1. Each character represents the correct answer to a single exam question The third line is the number of students

Each line after that contains a complete set of answers by a single student

    1. Again, each character represents an answer to a single exam question

Example Input:

12

abcababbaddc

3

abcabacbacdc

abcbbbbdadda

abcababdaddc

1

CS 1120 Fall 2017 LA 1 Automatic Exam Grader

The application should exhibit the following functionality (see the sample output below):

Read the input from an input text file (see the example with file contents above)

Display the question number and indication of the correct answer—one question per line

Display the students’ answers in columns (with headers as shown below), preceded by consecutive numbers

o If a student’s answer is incorrect, also show the correct answer in parentheses Display the scores of each student, one student per line

  1. Show the score both as a percent of the maximum score, and as a letter grade, according to the following chart:

    • A: 90% or greater

    • B: 80% – 99%

    • C: 70% – 89%

    • D: 60% – 79%

    • E: 59% or lower

The output must follow precisely the format of the Example Output below. This includes using the identical indentation and headers.

Example Output:

Answer Key:

  1. a

  2. b

  3. c

  4. a

  5. b

  6. a

  7. b

  8. b

  9. a

  10. d

  11. d

  12. c

Student Answers:

Student 1

Student 2

Student 3

1)

a

1)

a

1)

a

2)

b

2)

b

2)

b

3)

c

3)

c

3)

c

4)

a

4)

b (a)

4)

a

5)

b

5)

b

5)

b

6)

a

6)

b (a)

6)

a

7)

c (b)

7)

b

7)

b

8)

b

8)

d (b)

8)

d (b)

9)

a

9)

a

9)

a

10)

c (d)

10)

d

10)

d

11)

d

11)

d

11)

d

12)

c

12)

a (c)

12)

c

Student 1: 83%

B

Student 2:

67%

D

Student 3:

92%

A

2

CS 1120 Fall 2017 LA 1 Automatic Exam Grader

Design Requirements

You should have 2 classes for this application – TestMChExam and MultipleChoiceExam. Your TestMChExam method should simply read the input data, instantiate one exam object, and then call the appropriate methods for the object to display the grading results. The remaining functionality listed above should be contained in MultipleChoiceExam.

Hints

  1. Use character arrays to hold the answers: one one-dimensional array for the answer key, and one two-dimensional array for the students’ answers.

  1. Break the program functionality into separate methods, and design the methods separately (starting with the top-level pseudocode for each method).

  1. Test your application with other inputs besides the example input given here, to make sure it works for all data.

  1. You can use the String’s charAt() method to get a single character from a string.

  1. When using the Scanner’s nextInt() method, remember that you need to consume the new line character after reading the integer in order to go to the next line of input:

Scanner inputFile = new Scanner(file); int x = inputFile.nextInt(); inputFile.nextLine(); //consume new line char

Additional Requirements

Software Life Cycle Report

You are required to write the SLC Report, explaining how you followed the nine phases of the Software Life Cycle in this assignment.

A proper design (with stepwise pseudocode refinement), proper coding method (with stepwise code refinement starting from the most detailed pseudocode refinement), and proper testing are essential. For reference, please see the Sample SLC Report (covered in class) on Elearning.

Note: Correct pseudocode development will be worth 40% of the total LA1 grade.

Coding Standards

You must adhere to all conventions in the CS 1120 Java coding standard (on Elearning for your Lab). This includes the use of white spaces and indentations for readability, and the use of comments to explain the meaning of various methods and attributes. Be sure to follow the conventions also for naming classes, variables, method parameters and methods.

3

CS 1120 Fall 2017 LA 1 Automatic Exam Grader

Assignment Submission

Generate a .zip file that contains all your files, including:

    • Program Files

    • Any input or output files

    • The SLC Report file (a text with description of all nine phases of Software Life Cycle) Submit the .zip file to the appropriate folder on Elearning

NOTE: The Elearning folder for LA submission will be inaccessible after the due date/time. Late submissions must be emailed to the Lab Instructor.

4