Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help with this C++ program comments are especially useful Olympic Lab be rewritten in object-oriented style. You have been selected for the joh Fortunately

need help with this C++ program comments are especially useful

image text in transcribedimage text in transcribedimage text in transcribed

Olympic Lab be rewritten in object-oriented style. You have been selected for the joh Fortunately (or perhaps not), some of the preliminary design work has e In ternational Olympic Committee needs your help. The co who won races based on the timing data from each lanprogram that figures out done, and the main program that inputs the data and prints it out has alread been written. Your job is to write two C++ classes, Competitor and R both declaration (h) and implementation (.cpp), to store information competitor in a race and to rank these competitors from lowest to highest finishing time. This code should be divided into four files: competitor.h competitor.cpp, ranker.h, and ranker.cpp Objects of the Competitor class are initialized with the person's name and lane assignment, specified as a character string and an integer. The person's name should be copied into the Competitor object's own memory; that is, don't just record the pointer that was passed in. Note that there should be no predefined size for the person's name. Also note that you should not use any C++ predefined String class for this lab. Since the person's time is not known at the outset, this value is set with a separate member function called setrime () which accepts a double floating-point value. There should also be member functions to retrieve the name, lane, and time, as well as a member function to print out the object as a single line of text. Finishing times should be output to one decimal place. Finally, don't forget to have the class destructor deallocate any storage when an object of this class goes out of scope Objects of the Ranker class are initialized with the number of items Competitor objects) to be ranked. Pointers to competitor objects are passed to an addlist() member function one by one. If a NULL pointer passed in, or if the total number of objects passed in exceeds the pre-define number of items, addList ) should number of competitor objects passed in. Items are from the list using two member functi accepts an integer from 1 to the number o return 0; otherwise, it returns the total getLane() and getFinish) retrieved (but not remov to the Competitor object in the specified lane, while get pointer to the competitor who finished at the specified f items in the list. geti Each returns a second, etc.). Finaly, when a Ranker object is destroyed, it frees ) returnsa t allocated for itseltf, but it does not delete the memory for the obiects (since it has no way of knowing how these were created). getFinish (0 any memory the competitor Focus orn

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

Transactions On Large Scale Data And Knowledge Centered Systems Xxviii Special Issue On Database And Expert Systems Applications Lncs 9940

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Qimin Chen

1st Edition

3662534541, 978-3662534540

More Books

Students also viewed these Databases questions

Question

3. Is there opportunity to improve current circumstances? How so?

Answered: 1 week ago

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago