Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program to grade the answers to a true-false quiz given to students in a course. The quiz consists of 5 true-false questions.

Write a C++ program to grade the answers to a true-false quiz given to students in a course. The quiz consists of 5 true-false questions. Each correct answer is worth 2 points.
a. Use main( ) as your driver function. Write main( ) so that it allows the user to run the program as many times as desired, as indicated by input from the user. No data validation is requires for this program.
b. Write appropriate individual functions that main( ) calls to accomplish the following tasks:
1. Read the number of students who took the quiz and their names. (Hint - Use a 1-D array for the names)
2. Read the answer key from the user. (Hint: Use a 1-D array for the answer key)
3. Read and store the answers for each student on the quiz. (Hint: use a 2-D array for the answers)
4. Calculate the grades. (Hint: Use a 1-D array for the grades)
5. Display each students name, quiz answers, and grade.
Sample Input:
This program calculates the grade for students taking a true-false quiz.
How many students took the quiz? 4
Please enter the answer key.
Answer #1: ? T
Answer #2: ? T
Answer #3: ? F
Answer #4: ? F
Answer #5: ? T
Please enter the students' names.
Student #1 Name: ? Mike Jones
Student #2 Name: ? John Smith
Student #3 Name: ? Betty Hill
Student #4 Name: ? George Green
Please enter the answers for Mike Jones.
Answer #1: ? T
Answer #2: ? F
Answer #3: ? T
Answer #4: ? F
Answer #5: ? T
Please enter the answers for John Smith.
Answer #1: ? F
Answer #2: ? T
Answer #3: ? F
Answer #4: ? T
Answer #5: ? F
Please enter the answers for Betty Hill.
Answer #1: ? T
Answer #2: ? T
Answer #3: ? T
Answer #4: ? T
Answer #5: ? T
Please enter the answers for George Green.
Answer #1: ? F
Answer #2: ? F
Answer #3: ? F
Answer #4: ? F
Answer #5: ? F
Sample Output:
Student Name Quiz Answers Grade
----------------- ------------------ --------
Key T T F F T 10
Mike Jones T F T F T 6
John Smith F T F T F 4
Betty Hill T T T T T 6
George Green F F F F F 4
Would you like to process another quiz? Please enter 'y' for yes or 'n' for no: y
Another Sample Input:
This program calculates the grade for students taking a true-false quiz.
How many students took the quiz? 2
Please enter the answer key.
Answer #1: ? F
Answer #2: ? F
Answer #3: ? T
Answer #4: ? F
Answer #5: ? T
Please enter the students' names.
Student #1 Name: ? Mary Hall
Student #2 Name: ? Neal Jones
Please enter the answers for Mary Hall.
Answer #1: ? T
Answer #2: ? F
Answer #3: ? T
Answer #4: ? F
Answer #5: ? F
Please enter the answers for Neal Jones.
Answer #1: ? T
Answer #2: ? F
Answer #3: ? T
Answer #4: ? F
Answer #5: ? T
Another Sample Output:
Student Name Quiz Answers Grade
----------------- ------------------ --------
Key F F T F T 10
Mary Hall T F T F F 6
Neal Jones T F T F T 8
Would you like to process another quiz? Please enter 'y' for yes or 'n' for no: n

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

Step: 3

blur-text-image

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

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions

Question

What is dividend payout ratio ?

Answered: 1 week ago

Question

Explain the factors affecting dividend policy in detail.

Answered: 1 week ago