Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please give a thorough answer and separate into the 3 files. (main.cpp, library.cpp, library.h) and show outputs. Lab 07 performance stats This lab asks you

please give a thorough answer and separate into the 3 files. (main.cpp, library.cpp, library.h) and show outputs.
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Lab 07 performance stats This lab asks you to use a vector object to help you organize and analyze the performance stats of your choice. The sample data and output provided below are based on the individual statistics of the CSUSM Men's Basketball Team who's been doing great this season. MON/FINAL MB/22/FINAL VEC MIRAIPINAL VOM TAVO WOO w W:54 To help you organize data, the following struct definition has been provided in the library.h file struct Data string name; double stat; } You are to define and implement the following functions. Keep the function prototypes in the "library.h" file and the function implementation in the library.cpp" file. Expand the main function to test these functions The "collect data function shall help collect data from an input file into a vector of Data objects. You get to choose the content and format of the input file to reflect your performance stats of choice. However, the data shall be organized in alphabetical order of the names for those you would like to analyze Here is a sample data file I created where each line contains the name and field goal percentage of one athlete on the Men's Basketball team Alex Gil-Fernandez,0.475 Blake Selts, 0.478 Chase Bowsher, 0.333 Donovan Watkins, 0.417 Ethan Barnella,0.200 Greg Milton II1,0.413 Jack Schultz,0.000 Jayce McCain, 0.548 Joel Mensah, 0.625 Lyle Sutton, 0.571 Tyrone Nesby IV, 0.385 Sean Dunn, 0.567 The "display_data" function shall help display data in the performance vector in a nice columned format. Here is a sample output Name Stat Alex Gil-Fernandez Blake Selts Chase Bowsher Donovan Watkins Ethan Barnella Greg Milton III Jack Schultz Jayce McCain Joel Mensah Lyle Sutton Tyrone Nesby IV Sean Dunn 0.475 0.478 0.333 0.417 0.200 0.413 0.000 0.548 0.625 0.571 0.385 0.567 The "sort_by_stat' function shall help sort the data in the performance vector in the descending order of the stats. That is, the Data object of the highest stat value shall be the first element in the vector while the Data object of the lowest stat value shall be the last element in the vector. Here's a sample output when calling the display_data function after calling the sort_by_stat function: Name Stat Joel Mensah Lyle Sutton Sean Dunn Jayce McCain Blake Selts Alex Gil-Fernandez Donovan Watkins Greg Milton III Tyrone Nesby IV Chase Bowsher Ethan Barnella Jack Schultz 0.625 0.571 0.567 0.548 0.478 0.475 0.417 0.413 0.385 0.333 0.200 0.000 The "remove_by_name" function shall help remove a Data object from the performance vector based on the name provided. If the name provided does not match anyone in the vector, simply keep the vector unchanged. Otherwise, the function should push the matched Data object to the end of the vector before calling the pop_back method. It is important for the remaining Data objects to stay in their relative orders before the removal. You are not allowed to use the erase method of the vector class in this function. . C 1 main.cpp 1 2 3 //Expand this file to test the functions you define. #include using namespace std; 4 int main() { 5 6 7 return 0; 00 8 9 } I library.cpp x 1 // Add implementation for the functions here E library.h x 1 Expand this file with the function prototypes 2 3 4 5 6 7 8 struct Data { std::string name; double stat; }

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 J. Auer

3rd Edition

0131986252, 978-0131986251

More Books

Students also viewed these Databases questions

Question

2. Describe how technology can impact intercultural interaction.

Answered: 1 week ago