Question
You have been asked to write a program to grade several multiple-choice exams. The exam has 20 questions, each answered with a letter in the
You have been asked to write a program to grade several multiple-choice exams. The
exam has 20 questions, each answered with a letter in the range of a through f. The
answers key is declared in the program as constant of type string. An example of answer
key is abcdefabcdefabcdefab. Your program should work for any other answer key.
The program should first ask users for the number of students to be graded. Then it
should have a while loop in the main function. For each student, the loop repeatedly asks
users to enter a student ID number and a string of characters representing the answers of
the student. The student ID number is of type string and should contain exactly 7 digits
(each digit between 0 and9). If a student ID number is incorrect, the program displays
and error message and prompts the user to re-enter that student information. If a student
gives more answers than necessary (more than 20 in our case), the program automatically
truncates the extra answers. On the other hand, if a student provides less number of
answers, the remaining unanswered questions are considered as being answered wrongly.
If for a given answer, the user enters a letter other than a, b, c, d, e, or f then the
question is considered as being wrongly answered.
Furthermore, in each while loop in the main routine, your program should compute a
percentile score for the student by comparing the answers for that student to the answers
key, and a curved grade in A though F based on the following:
>=90
A
<90 and>=80
B
<80 and>= 70
C
<70 and>= 60
D
<60 and>= 50
E
<50
F
The results of each student are displayed by the student in the format: percentile score
and a curved grade in A though F.
The program should also compute and display the following statistics for the graded
answers: Average score, Maximum score, and Minimum score.
Use the following inputs to test your program:
Answer key = abcdefabcdefabcdefab
abbcdaefcdffbceffadbc
Please enter the number of students to be graded: 5
For each of the following students, enter the Student ID and answers:
Student 1: 1234567 abcdefabcdefabcdefab
Score: 100% A
Student 2: 9876543 abddefbbbdefcbcdefac
Score: 75% C
Student 3: 555444656 abcdefabcdefabcd
ERROR in the Student ID number. Please re-enter Student 3 information:
Student 3: 5554446 abcdefabcdefabcd
Score: 80% B
Student 4: 4445556 abcdefabcdefabcdefabcdaedf
Score: 100% A
Student 5: 5551112 abbcdaefcdffbceffadbc
Score: 30% F
Statistics:
Average Score: 75%
Minimum Score: 100%
Maximum Score: 30%
The score of student 5 is 30% (6/20). Student 5 gives 21 answers, compared to 20
answers in the key. We discard any extra answers, which are more than 20.
To provide solutions to this project, you need to deliver the following components on the
basis of principles in software engineering.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started