Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are to write a C program that grades a true-false quiz. The quiz data will be available in a text file; here is an

You are to write a C program that grades a true-false quiz. The quiz data will be available in a text file; here is an example:

Quiz #8 (09/22/14) (corrected version) TTFTTFTFTF 0080 TTFTTFTFTF 0340 TTFTFFTFTF 
1522 TTFFFFTFTF 9001 TFFTTTTTTF 0012 FFTFTFTFTF 9013 TTFTTTFTFT 0913 TTTFFTFTTF 6155 FFTTTTTTFT 3144 FFTTFTTTFT 4400 FFTFFTFTFF 0 

The first line in the data file is a comment that you may assume can be up to 80 charac- ters long; it cannot be blank. The second line contains the answer key for the 10-question true-false quiz. The following lines in the data file contain a students id number in column 1 followed by their answers for the quiz in column 2. A 0 (zero) on a line by itself indicates that there are no more students to process.

Write a program that first reads in (from standard input; more on this in a moment) the comment line and answer key as strings (i.e. into a char array; see the example code below) followed by each students data. Store the students id numbers in an array. You are to grade each students quiz using the key provided followed by recording their scores (in a second array) in order to be able to print them out later. You do not need to use an array of strings or characters in your program to store these ids and scores. Write your program allowing for up to 100 students, and you may assume that at least 1 student will have taken the quiz.

You should create test data text files and provide the data to your program using redirection from the command line (see the sample run below). Your program should output the number of students who took the quiz, the average score, the best score, and a table showing each students id, score, and grade. The formatting, spacing, and labels in your output should match the sample run below exactly.

Your program should determine each students grade as follows: if the score is equal to the best score b or b1, give an A. If it is b2, award a B. Give Cs for any score that is equal to b 3 or b 4, a D for b 5 and an F for all others.

image text in transcribed

Quiz #8 (09/22/14) (corrected version) key: TTFTTFTFT # of students: 10 average score: 5.50 best score: 10 id score arade 0080 10 03409 1522 8 9001 7 00126 9013 5 0913 4 6155 3 3144 2 4400 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions

Question

Influences on Nonverbal Communication?

Answered: 1 week ago