Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Class Average Write a C++ program that will ask the user for the name of a data file. If the file does not open, exit
Class Average Write a C++ program that will ask the user for the name of a data file. If the file does not open, exit the program. This data file contains a list of students in some class. The names are listed, one per line, in the following format: lastName firstName middlelnitial and each part of the name is separated by a space. Each student in this class has a data file that contains an unknown number of test scores. The name of each student s data file is formed by concatenating the students first and last name and adding ".dat" , for example: Student Name: Tuel Dennis D Student Data File: DennisTuel.dat Your program should open each student' s data file, read in the scores and calculate the student' s average. In addition to calculating the average for each student you should report the average for the class, and the highest and lowest test score in the class. Note: All averages should be rounded to the nearest hundredth. cout Students Average Dennis D Tuel 87.75 Ann M Drummond 86.00 Virginia L Maxwell 81.00 Class Average: 84.92 Max Score: 98.00 Min Score 68.00 Enter Name of Data File: names. dat Student Scott A Patterson Jim J Jones Ann M Smith Bobby B Baylor Krissy B Lastovica Ronnie R Hinze Richard W Gilpatrick Jeff K Pustka Average 64. 00 76. 31 74.02 No Grades 75. 17 75. 66 No Data File 75. 02 Class Average: 75. 19 Max Score: 193.00 Min Score: -53.00
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started