Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In C++ please! Problem Statement You must develop a program to read MotoGP rider information from an input file and then output summary information and
In C++ please!
Problem Statement You must develop a program to read MotoGP rider information from an input file and then output summary information and details about each rider to an output file. Problem Details You will need a MotoGpRider class whose instances will be used to store the statistics for a MotoGP motorcycle racer. The MotoGpRider class will have attributes for last name, first name, racing number, nation, motorcycle make, world championship points, and world championship position. You must read the MotoGP rider information from an input file. Each line of the input file will contain a single rider's name and information, in the order the information is listed above. All information on the line will be separated by spaces. Operations for the MotoGpRider class: A non-default constructor o Pass in values read from the input file. A default constructor. Use "unknown" as default string values and O as default numeric values. Get methods for any data fields that need to be accessed later, e.g., the test driver (main() program) will need to print certain information. A method to return summary rider information as a string (to be printed in the summary table described later) A method to return the rider's full name (first name followed by last name) To store multiple MotoGP riders, you are to implement a Riderlist data structure/data type (i.e., class) that stores riders using an internal array in the class. Read each rider from the input file, store the information in a MotoGpRider object, and then add the MotoGP rider to the list. Your RiderList structure should hold a maximum of 10 riders. You must track the number of riders actually stored in the list, since the data file could contain fewer or greater than 10 riders. You will need to make sure the list is not full before adding a new rider. You may assume there are no errors in the input data. I will not leave data out or put non-numeric data in numeric fields. You must implement the following operations on your List along with any other utility functions you need. You may also need to add operations to your rider to encapsulate 1/0 operations to the class. Operations for the Riderlist class: Default Constructor - initialize the number of riders to O Add a rider to the List - add items in the order they were found in the file. No sorting is necessary in this version of the program. Iterate through the List so that you can get each item out for printing o You must implement reset(), hasNext() and getNext() on your list for this to work. o Note the array itself must stay hidden (use information hiding/encapsulation), i.e., a client of the class must not know the list is stored as an array Clear out the list to make it empty Test if the list is full Get the size of the list Summary of Operations Prompt the user for the input and output file names. DO NOT hardcode file names into your program. Open input file. Read each rider's information and add the rider to your list structure. Open output file. Write a report summary to the output file, which contains a table of World Championship statistics for each rider. Print a title and headers for the table, and then add a line for each rider that contains o The rider's full name, their number, their World Championship points, and their World Championship position. Below the table, write the details for each rider from the list into the output file. This should include each of the following items on a separate line: the rider's o full name O number o motorcycle make nation world championship position Make sure your output is neat! . Sample Input File and Corresponding Output File sample input text file Rossi Valentino 46 Italy Yamaha 1983 Marquez Marc 93 Spain Honda 321 1 Dovizioso Andrea 4 Italy Ducati 245 2 Vinales Maverick 12 Spain Yamaha 1936 Note- there should be NO blank lines ofter the last line of data in an input file. sample output text file 2018 World Championship Statistics RIDER NAME NUMBER POINTS POSITION Valentino Rossi : Marc Marquez : Andrea Dovizioso : Maverick Vinales : 46 93 4 12 198 321 245 193 RIDERS Valentino Rossi Number Motorcycle Nation Position : 46 : Yamaha : Italy 3 Marc Marquez Number Motorcycle Nation Position 93 Honda : Spain 1 Andrea Dovizioso Number Motorcycle Nation Position 4 Ducati : Italy 2 Maverick Vinales Number Motorcycle Nation Position : 12 Yamaha : Spain 4 Problem Statement You must develop a program to read MotoGP rider information from an input file and then output summary information and details about each rider to an output file. Problem Details You will need a MotoGpRider class whose instances will be used to store the statistics for a MotoGP motorcycle racer. The MotoGpRider class will have attributes for last name, first name, racing number, nation, motorcycle make, world championship points, and world championship position. You must read the MotoGP rider information from an input file. Each line of the input file will contain a single rider's name and information, in the order the information is listed above. All information on the line will be separated by spaces. Operations for the MotoGpRider class: A non-default constructor o Pass in values read from the input file. A default constructor. Use "unknown" as default string values and O as default numeric values. Get methods for any data fields that need to be accessed later, e.g., the test driver (main() program) will need to print certain information. A method to return summary rider information as a string (to be printed in the summary table described later) A method to return the rider's full name (first name followed by last name) To store multiple MotoGP riders, you are to implement a Riderlist data structure/data type (i.e., class) that stores riders using an internal array in the class. Read each rider from the input file, store the information in a MotoGpRider object, and then add the MotoGP rider to the list. Your RiderList structure should hold a maximum of 10 riders. You must track the number of riders actually stored in the list, since the data file could contain fewer or greater than 10 riders. You will need to make sure the list is not full before adding a new rider. You may assume there are no errors in the input data. I will not leave data out or put non-numeric data in numeric fields. You must implement the following operations on your List along with any other utility functions you need. You may also need to add operations to your rider to encapsulate 1/0 operations to the class. Operations for the Riderlist class: Default Constructor - initialize the number of riders to O Add a rider to the List - add items in the order they were found in the file. No sorting is necessary in this version of the program. Iterate through the List so that you can get each item out for printing o You must implement reset(), hasNext() and getNext() on your list for this to work. o Note the array itself must stay hidden (use information hiding/encapsulation), i.e., a client of the class must not know the list is stored as an array Clear out the list to make it empty Test if the list is full Get the size of the list Summary of Operations Prompt the user for the input and output file names. DO NOT hardcode file names into your program. Open input file. Read each rider's information and add the rider to your list structure. Open output file. Write a report summary to the output file, which contains a table of World Championship statistics for each rider. Print a title and headers for the table, and then add a line for each rider that contains o The rider's full name, their number, their World Championship points, and their World Championship position. Below the table, write the details for each rider from the list into the output file. This should include each of the following items on a separate line: the rider's o full name O number o motorcycle make nation world championship position Make sure your output is neat! . Sample Input File and Corresponding Output File sample input text file Rossi Valentino 46 Italy Yamaha 1983 Marquez Marc 93 Spain Honda 321 1 Dovizioso Andrea 4 Italy Ducati 245 2 Vinales Maverick 12 Spain Yamaha 1936 Note- there should be NO blank lines ofter the last line of data in an input file. sample output text file 2018 World Championship Statistics RIDER NAME NUMBER POINTS POSITION Valentino Rossi : Marc Marquez : Andrea Dovizioso : Maverick Vinales : 46 93 4 12 198 321 245 193 RIDERS Valentino Rossi Number Motorcycle Nation Position : 46 : Yamaha : Italy 3 Marc Marquez Number Motorcycle Nation Position 93 Honda : Spain 1 Andrea Dovizioso Number Motorcycle Nation Position 4 Ducati : Italy 2 Maverick Vinales Number Motorcycle Nation Position : 12 Yamaha : Spain 4Step 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