Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help me with this c++ question. implement the three methods follow the descriptions that in the header file. Inside the file_name, there are: number_of_student,

please help me with this c++ question. implement the three methods follow the descriptions that in the header file.

Inside the file_name, there are:

number_of_student,

student_id, number_of_grades, grade_0, grade_1...

student_id, number_of_grades, grade_0, grade_1...

student_id, number_of_grades, grade_0, grade_1..

this is the header file :

#include

/* Description: * Extracts a single grade for a given student and given grade number. * Preconditions: * - If file exists, it is correctly formatted * Parameters: * - student_id: the id of the student for grade * - grade_no: the grade to be returned for matching student_id * - file_name: path and name of gradebook file * Returns: * - Grade selected * - floating point -1.0 when student is not found (or no students exist) * - floating point -2.0 when grade_no is not found (or no student grades) * - floating point -3.0 when file cannot be opened */ double GetGrade(int student_id, int grade_no, const char* file_name);

/* Description: * Extracts the id of the student with the highest grade. * Preconditions: * - If file exists, it is correctly formatted * - Grades are nonnegative. * Parameters: * - file_name: path and name of gradebook file * Returns: * - The id of the student with the highest grade. * - Integer -1 when no students exist * - Integer -2 when no grades exist for students * - Integer -3 when the file cannot be opened */ int GetMaxGradeStudentId(const char* file_name);

/* Description: * Calculates the average for all students in file. * Preconditions: * - If file exists, it is correctly formatted * - Grades are nonnegative. Adjust accordingly. * Parameters: * - file_name: path and name of gradebook file * Returns: * - The highest grade found. * - Floating point -1.0 when no students exist * - Floating point -2.0 when no grades exist * - Floating point -3.0 when the file cannot be opened */ double GetAvgGrade(const char* file_name);

This is the file that need to read in, called file_name :

3 101 2 60.0 40.0 294 3 10.0 20.0 30.0 376 1 75.0

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 M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

9. Mohawk Industries Inc.

Answered: 1 week ago

Question

8. Satyam Computer Services Limited

Answered: 1 week ago

Question

2. Explain how the role of training is changing.

Answered: 1 week ago