Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program requires the utilization of concepts in Chapter 4, 5 and 6. Information regarding the test scores for a class is stored in an

image text in transcribedThis program requires the utilization of concepts in Chapter 4, 5 and 6. Information regarding the test scores for a class is stored in an input file. The test scores and some supporting information is read from the input file. This information is then processed and written to an output file (see the sample output shown above). Using command line arguments for an input file and output file name (see command line argument slides and page 3), print out the command line input file name (see the sample solution for the phrasing to use) and open the input file provided. Verify that the file opened successfully (file stream is valid). If it did not open successfully, enter a while loop that outputs an error message, resets the input file stream being opened and prompts the user to enter another input file name. This file name is read, echo printed and opened. The loop continues until the input file is successfully opened. See project 5 for the error message information the while loop is the exact same (without the return 1;) just replace if with while. If the input file is successfully opened, print out the command line output file name and open the output file provided. Verify that the output file opened successfully. If it did not open successfully, enter a while loop that outputs an error message, resets the output file stream being opened and prompts the user to enter another output file name. This file name is read, echo printed and opened. The loop continues until the output file is successfully opened. Use the filename Bad/file to cause the open function to fail for the output file. The input file contains three lines. The first line is a header line containing the name of the person submitting the grades. The second line consists of 4 integer grades separated by white space. The last line is an information line that is to be used when writing to the output file. This information line is a phrase similar to Test scores for section 01:. See the sample input files for further information. When reading the data from the file, the first line is read and ignored (no information is required from it). Then the four scores are read and stored in integer variables. After reading the scores, the status of the input stream is tested to verify that it is still valid. If the input stream is in the fail state mode, an appropriate error message is printed to the terminal AND the output file, and the program is terminated. If the input stream is valid, the scores are tested to ensure that they have positive values. If any score is less than 0, then the program prints out a message and the scores read to the terminal AND to the output file. The program is then terminated. If all scores read are greater than or equal to 0 and the input stream is still valid, the scores read are analyzed to determine their sum, average, letter grade for the average, variance(population not sample- see next page) and standard deviation. Formulas for performing these math functions are shown on the next page. The cmath header file may be needed for some of the math functions in the formulas. The letter grade for the average is based on the following scale for the average:

This program requires the utilization of concepts in Chapter 4, 5 and 6. Information regarding the test scores for a class is stored in an input file. The test scores and some supporting information is read from the input file. This information is then processed and written to an output file (see the sample output shown above). Using command line arguments for an input file and output file name (see command line argument slides and page 3), print out the command line input file name (see the sample solution for the phrasing to use) and open the input file provided. Verify that the file opened successfully (file stream is valid). If it did not open successfully, enter a while loop that outputs an error message, resets the input file stream being opened and prompts the user to enter another input file name. This file name is read, echo printed and opened. The loop continues until the input file is successfully opened. See project 5 for the error message information - the while loop is the exact same (without the return 1;) just replace if with while. If the input file is successfully opened, print out the command line output file name and open the output file provided. Verify that the output file opened successfully. If it did not open successfully, enter a while loop that outputs an error message, resets the output file stream being opened and prompts the user to enter another output file name. This file name is read, echo printed and opened. The loop continues until the output file is successfully opened. Use the filename "Bad/file" to cause the open function to fail for the output file. The input file contains three lines. The first line is a header line containing the name of the person submitting the grades. The second line consists of 4 integer grades separated by white space. The last line is an information line that is to be used when writing to the output file. This information line is a phrase similar to "Test scores for section 01:". See the sample input files for further information. When reading the data from the file, the first line is read and ignored (no information is required from it). Then the four scores are read and stored in integer variables. After reading the scores, the status of the input stream is tested to verify that it is still valid. If the input stream is in the fail state mode, an appropriate error message is printed to the terminal AND the output file, and the program is terminated. If the input stream is valid, the scores are tested to ensure that they have positive values. If any score is less than 0, then the program prints out a message and the scores read to the terminal AND to the output file. The program is then terminated. If all scores read are greater than or equal to 0 and the input stream is still valid, the scores read are analyzed to determine their sum, average, letter grade for the average, variance(population not sample- see next page) and standard deviation. Formulas for performing these math functions are shown on the next page. The cmath header file may be needed for some of the math functions in the formulas. The letter grade for the average is based on the following scale for the average: Letter Grade A B Average >= 90 >= 80 >= 70 >= 60 = 90 >= 80 >= 70 >= 60

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

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions

Question

What does the term business mean to you?

Answered: 1 week ago

Question

6-25. IMHO, our quad turbo sprayer is best model 4U.

Answered: 1 week ago

Question

=+f. Do you think this Fed chairman was a good appointment?

Answered: 1 week ago