Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Whats inside the testinput.dat file: Whats inside the testoutput.txt file:c Testing: Working With File I/O Write a program that reads students' grades from a file

image text in transcribed

Whats inside the testinput.dat file:

image text in transcribed

Whats inside the testoutput.txt file:c

image text in transcribed

Testing:

image text in transcribed

Working With File I/O Write a program that reads students' grades from a file and calculates the average with the lowest grade dropped. The input data file contains a set of student records, with one student per line. Each line of the input data file has the following structure: last_name first_name grade1 grade2 grade3 ... graden Each item on a line is separated by a space (or spaces). last_name and first name are of type string and the grades are of type int. The range for valid grades is 0 to 100 inclusive. It is possible for a line in the data file to have a student's name without any grades. Each line of output for this program should contain the following information: the student's first and last name, followed by each valid grade that was read, followed by the average of all valid grades where the lowest grade was dropped. The average should be formatted to 4 decimal places. If a student does not have any valid grades- or no grades at allthen the output should be: first_name last_name N/A Program Requirements 1. Name your source code file average.cpp. 2. Write and use!) a function named openfile that takes an ifstream object as a parameter. The function prompts the user for the name of the data file and opens the file for reading. If the call to open fails, the function should gracefully terminate the program. CISC 2000 Computer Science II Homework Assignment 3 3. Overload the function openfile such that it takes an ofstream object as a parameter. The function prompts the user for the name of the output file and opens it for writing. If the call to open fails, the function should gracefully terminate the program. 4. A valid grade is a grade between 0 and 100 inclusive. Write a function that returns a bool and takes 3 parameters: a grade; the minimum valid grade; and the maximum valid grade. The function should return true if minimum grade grade

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 Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions

Question

Explain the cultural diversity of entrepreneurship. L-254

Answered: 1 week ago