How can I write main function for this c++ program, the main function includes a file called racer.h which has the following information: (Assume that I have already created racer.h file which has racer, timestamp, and sensor class defined.) ------------------------  (Note: The sensor class can have functions to determine if two sensors are adjacent and calculate the speed between them, while the time stamp class can have functions to calculate the time elapsed between two time stamps.) The Racer class must have at least: 1.    Private data: racer number (an integer), an unknown number of sensor data. Sensor data includes sensor number (an integer that starts at 0 for start time; the last sensor is the finish line), mile marker for the sensor (a double) and time stamp for each sensor (when the racer passed the sensor) with hour, minute, second and millisecond. (You may also want instance variables that holds a racer’s total race time, total race distance, total race speed.) 2.    Default constructor 3.    Copy constructor: make sure the code copies any vectors contained in the class 4.    Set and get functions for private data 5.    A “get” function that computes and returns the racer’s total time to complete the race 6.    Overloaded operator< (a racer is < another if the racer’s total race time is less than the other’s) 7.    Overloaded operator= 8.    Overloaded operator>> that reads a racer’s data from its istream parameter. Use this function to read a Racer object from the input file. 9.    Overloaded operator<< that prints a Racer object to its ostream parameter in the format such as the one shown below (concatenate an asterisk to the output name for any potential cheater) Georno Milleer                                 1    00:43:12:002 Ask the user to provide the name of a text file containing the race log, where the fields are separated by semicolons. If the file is not found or is empty, display an appropriate error message. The gun time, which indicates when the race officially began, is located in the first line of the file. The start times for each racer (i.e. their first sensor) may differ from the gun time since not every racer crosses the starting line at the same time. The input file is free of errors and the time values are in military format and do not exceed a single day. The input file follows this format: hour:minute:second:millisecond;total number of sensors;total number of miles in the race; racer name;racer number;sensor number;sensor mile marker;sensor time[:more sensor info]. Here is an example input file for a race spanning 9.3 miles (~15km), consisting of 4 sensors and 7 racers. 8:0:0:0;4;9.3 Paul Waler;123;0;0;8:1:30:0;1;3.1;8:16:15:45;2;6.2;8:32:45:59;3;9.3;8:48:15:12 Georno Miller;1;0;0;8:0:0:0;1;3.1;8:14:39:0;2;6.2;8:29:33:0;3;9.3;8:43:12:2 Jeanna Venas;111;0;0;8:12:1:0;1;3.1;8:40:30:0;2;6.2;9:7:45:9;3;9.3;9:31:3:25 Jolly SKywalker;456;0;0;8:9:12:9;1;3.1;8:33:45:0;2;6.2;8:57:59:0;3;9.3;9:21:30:30 Las Athanatos;432;0;0;8:15:0:0;1;3.1;9:00:0:0;2;6.2;9:45:0:0;3;9.3;10:30:0:0 Ms. Cheater;987;0;0;8:0:0:0;1;3.1;8:7:23:0;3;9.3;8:21:45:1 Mr. Cheater;6789;0;0;8:1:0:12;1;3.1;8:3:45:0;2;6.2;8:9:32:1;3;9.3;8:15:32:15 --------------------------------- I have mentioned below how the desired output should look like. Here's extra information: Display on the screen a table that arranges the racers' times in ascending order and adds an asterisk symbol next to the names of racers whose data seems unreliable. The names of the racers should not exceed 30 characters, and the racer numbers should not exceed 6 digits. The time format to be printed should be HH:MM:SS:mmm. Welcome to the Racing Program! Enter race file: Racingdata.dat Name                                      Number       Time ---------------------------------------------------------------- *Mr. Cheater                                6789    00:14:32:003 *Ms. Cheater                                 987    00:21:45:001 Georno Miller                                 1    00:43:12:002 Paul Walkere                              123    00:46:45:012 Jolly Skywalker                            456    01:12:18:021 Jeanna Venas                               111    01:19:02:025 Las Venas                                     432    02:15:00:000 Thank you for using Racing Program

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

How can I write main function for this c++ program, the main function includes a file called racer.h which has the following information:

(Assume that I have already created racer.h file which has racer, timestamp, and sensor class defined.)
------------------------
 (Note: The sensor class can have functions to determine if two sensors are adjacent and calculate the speed between them, while the time stamp class can have functions to calculate the time elapsed between two time stamps.)

The Racer class must have at least:
1.    Private data: racer number (an integer), an unknown number of sensor data. Sensor data includes sensor number (an integer that starts at 0 for start time; the last sensor is the finish line), mile marker for the sensor (a double) and time stamp for each sensor (when the racer passed the sensor) with hour, minute, second and millisecond. (You may also want instance variables that holds a racer’s total race time, total race distance, total race speed.)
2.    Default constructor
3.    Copy constructor: make sure the code copies any vectors contained in the class
4.    Set and get functions for private data
5.    A “get” function that computes and returns the racer’s total time to complete the race
6.    Overloaded operator< (a racer is < another if the racer’s total race time is less than the other’s)
7.    Overloaded operator=
8.    Overloaded operator>> that reads a racer’s data from its istream parameter. Use this function to read a Racer object from the input file.
9.    Overloaded operator<< that prints a Racer object to its ostream parameter in the format such as the one shown below (concatenate an asterisk to the output name for any potential cheater)
Georno Milleer                                 1    00:43:12:002
Ask the user to provide the name of a text file containing the race log, where the fields are separated by semicolons. If the file is not found or is empty, display an appropriate error message. The gun time, which indicates when the race officially began, is located in the first line of the file. The start times for each racer (i.e. their first sensor) may differ from the gun time since not every racer crosses the starting line at the same time. The input file is free of errors and the time values are in military format and do not exceed a single day. The input file follows this format: hour:minute:second:millisecond;total number of sensors;total number of miles in the race; racer name;racer number;sensor number;sensor mile marker;sensor time[:more sensor info]. Here is an example input file for a race spanning 9.3 miles (~15km), consisting of 4 sensors and 7 racers.
8:0:0:0;4;9.3
Paul Waler;123;0;0;8:1:30:0;1;3.1;8:16:15:45;2;6.2;8:32:45:59;3;9.3;8:48:15:12
Georno Miller;1;0;0;8:0:0:0;1;3.1;8:14:39:0;2;6.2;8:29:33:0;3;9.3;8:43:12:2
Jeanna Venas;111;0;0;8:12:1:0;1;3.1;8:40:30:0;2;6.2;9:7:45:9;3;9.3;9:31:3:25
Jolly SKywalker;456;0;0;8:9:12:9;1;3.1;8:33:45:0;2;6.2;8:57:59:0;3;9.3;9:21:30:30
Las Athanatos;432;0;0;8:15:0:0;1;3.1;9:00:0:0;2;6.2;9:45:0:0;3;9.3;10:30:0:0
Ms. Cheater;987;0;0;8:0:0:0;1;3.1;8:7:23:0;3;9.3;8:21:45:1
Mr. Cheater;6789;0;0;8:1:0:12;1;3.1;8:3:45:0;2;6.2;8:9:32:1;3;9.3;8:15:32:15
---------------------------------
I have mentioned below how the desired output should look like. Here's extra information:
Display on the screen a table that arranges the racers' times in ascending order and adds an asterisk symbol next to the names of racers whose data seems unreliable. The names of the racers should not exceed 30 characters, and the racer numbers should not exceed 6 digits. The time format to be printed should be HH:MM:SS:mmm.

Welcome to the Racing Program!

Enter race file: Racingdata.dat

Name                                      Number       Time

----------------------------------------------------------------

*Mr. Cheater                                6789    00:14:32:003

*Ms. Cheater                                 987    00:21:45:001

Georno Miller                                 1    00:43:12:002

Paul Walkere                              123    00:46:45:012

Jolly Skywalker                            456    01:12:18:021

Jeanna Venas                               111    01:19:02:025

Las Venas                                     432    02:15:00:000

Thank you for using Racing Program!

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education