I have a program due for class and am completely lost on how to even start.
Assignment:
You are working for a company that administers multiple choice tests electronically. The students' IDs
and test answers are stored in a file called “testScores.txt”. The first line of the file will contain an
integer indicating the number of test questions and another integer representing the number of students
that took the test. The second line will contain the test answers in the form:
AABCADBCDABDCDCABDAC
Every other entry in the file is the student ID, following by a blank, followed by the student's
responses. For example, the entry:
AMB3006 ACBCADCCD BDDDCABDAC
indicates that the student ID is AMB7226 and their answer to question 1 is A, their answer to question 2
is C, and so on. This student did not answer question 9, which is indicated by a blank. Each correct
answer is awarded two points, each wrong answer gets -1 point, and no answer get 0 points.
Write a program that processes the test data. The output should be each student's ID, followed by their
answers, followed by the test score, followed by the test grade. For example:
INDIVIDUAL TEST RESULTS
=======================
AMB3006 ACBCADCCD BDDDCABDAC 29 C
JJS4820 DABCADCCDABDCDCABDAC 34 B
The first student answered 16 questions correctly, 3 questions incorrectly, and skipped 1 question,
giving them a score of 29. Since there are 20 questions, the maximum score is 40, so this student's
percentage is 29/40 = 72.5%. Assume the class uses the standard 10 point scale:
90-100% = A, 80-89% = B, 70-79% = C, 60-69% = D, 0-59% = F
After all students responses have been processed, print out the class average score and grade. Next,
present the user with a menu containing the following options:
1. Write test results to a file
2. View question statistics
3. Exit
•If option 1 is selected, write the result data (the ID, answers, score, and grade for all students)
and class average grade and score to a file named “testResults.txt”.
•If option 2 is selected, ask the user which question they wish to see individual statistics for.
Verify that this is an integer between 1 and the number of the last question. Print out the number
and percentage of students that gave each response. Indicate which response was correct.
For example (the following sample output assumes the test has 50 questions and was taken by 126
students. Values in red bold were entered by the user.):
1) Write test results to a file.
2) View individual statistics
3) Exit
Enter choice: 2
Which question would like to view (1-50) ? 84
That question does not exist on this test. Please try again. 29
Statistics for Question 29:
===========================
20 of 126 students (15.87%) selected response A.
85 of 126 students (67.46%) selected response B (correct).
11 of 126 students (8.73%) selected response C.
8 of 126 students (6.35%) selected response D.
2 of 126 students (1.59%) did not answer the question.
1) Write test results to a file.
2) View individual statistics
3) Exit
Enter choice:
After displaying the question statistics or printing the results to the file, display the menu again.
Continue to do so until the user selects the “Exit” option.
Other Requirements
• Do not use any global variables.
• Include appropriate functions. The entire program should not exist in main(). Use your own
judgment to determine appropriate functions.
• You must only use dynamically allocated arrays when you need to store information in an array.
• You can assume that the only possible responses are A, B, C, D, and no response (blank).
• You can assume that the file is properly formatted, but all user input must be properly validated.
• There is no need to sort the data by student or by grade (or by anything else). Just print the
students' results in the order they appear in the file.
• All decimal values should be formatted to 2 decimal places.
• Your output, except for the individual test results, does not have to be exactly as shown here, as
long as all required information is displayed.
Well this assignment is made up of different section and are broken down for you, file handling, string/character search ... just break it down to small bits.
1st make your program read from the file mentioned and view the output and do the next requirement.