Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ help! Write a program to compute numeric grades for a course. The course records are in a file that will serve as the input

C++ help! Write a program to compute numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: each line contains a students last name, then one space, then the students first name, then one space, then ten quiz scores all on one line. The quiz scores are whole numbers and are separated by spaces. Your program will take its input from this file and send its output to a second file. The data in the output file will be the same as the data in the input file except that there will be one additional number (of type double ) at the end of each line. This number will be the average of the students ten quiz scores. At the same time as you output to the file, also output the students full name an average quiz score to the console. Use a function for computing the average of each students quiz scores. Pass the stream objects for the input and output file. Make sure to pass them by reference so that any changes made to their streams (advancing the stream) will be present when you get back to int main. This function should read in only the quiz scores and then output the quiz scores and average score to the output file. You may use the following prototype for the function: void calcAvg(ifstream& in, ofstream& out); Your program should be able to handle any number of students in the input file. A sample input file has been provided. There is no guarantee that this exact file will be used for grading so make sure your program is robust. Make sure your program can handle missing and unopenable files.

Sample Output: Console (given provided input file)

Damian Hess 6.5

Andrew Nielsen 6.2

Alfred Yankovic 6.9

Inga Scharf 7.6

Sample Output: lab08_out.txt (given provided input file)

Hess Damian 5 10 7 5 9 2 8 5 6 8 6.5

Nielsen Andrew 7 9 8 7 4 7 3 4 9 4 6.2

Yankovic Alfred 6 5 8 10 9 6 5 7 3 10 6.9

Scharf Inga 9 2 7 10 7 8 8 10 6 9 7.6

image text in transcribed

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 Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago