Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ program that will allow race judges to manage and then award points to runne

ID: 3568086 • Letter: C

Question

C++ program that will allow race judges to manage and then award points to runners according to their finishing position. It provides services needed to manage a race under the "OPEN RACE" standard adopted by the Humans United for Racing Limited. (HURL) - see formal standard labeled: (HURL-OR_ icuducme_ver_1.3.X).

USER SERVICES(INTERRFACE):The following are methods that can be used as part of the AWARDER class

Constructors:
- AWARDER : will setup a complete race environment but with Zero (0) capacity.
- AWARDER(int) : sets the limit of number of runners allowed to finish

Methods:
- setMultiplier(int) : sets the multiplier to be used for awarding points
- openRace( ) : open the race to allow adding of runners
- closeRace( ) : close the race to stop anymore runners recorded at finish
- addRunner( ) : record that a runner has begun the race
- recordFinish(int) : a 1-4 digit id for each runner (assumes unique)
- computePoints( ) : compute the points before awarding
- awardPoints( ) : award the points for the race

Explanation / Answer

// Includes
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;

// Main Function
int main()
{
   string name1 , name2 , name3;
   float time1 , time2 , time3;
   double first , second , third;

   cout << "This displays who came 1st , 2nd, 3rd. ";

   cout << "Enter name1: ";
   getline(cin , name1);
   cout << "Enter name2: ";
   getline(cin , name2);
   cout << "Enter name3: ";
   getline(cin , name3);
   cout << "Enter time1: ";
   cin >> time1;
   cout << "Enter time2: ";
   cin >> time2;
   cout << "Enter time3: ";
   cin >> time3;

   while (time1 < 0 || time2 < 0 || time3 < 0)
   {
       cout << " The times must be greater than 0. ";
       cout << "Enter name1: ";
       getline(cin , name1);
       cout << "Enter name2: ";
       getline(cin , name2);
       cout << "Enter name3: ";
       getline(cin , name3);
       cout << "Enter time1: ";
       cin >> time1;
       cout << "Enter time2: ";
       cin >> time2;
       cout << "Enter time3: ";
       cin >> time3;
   }

   cout.setf(ios_base::fixed , ios_base::floatfield);
   cout.precision(1);

   cout << " ";

   if (time1 < time2 && time1 < time3)
   {
       first = time1;
       cout << first << endl;
       cout << name1 << " came in 1st with a time of " << first << endl;
   }
   else if (time2 < time1 && time2 < time3)
   {
       first = time2;
       cout << name2 << " came in 1st with a time of " << first << endl;
   }
   else if (time3 < time1 && time3 < time2)
   {
       first = time3;
       cout << name3 << " came in 1st with a time of " << first << endl;
   }

   if (time1 < time3 && time1 > time3)
   {
       second = time1;
       cout << name1 << " came in 2nd with a time of " << second << endl;
   }
   else if (time2 < time3 && time2 > time1)
   {
       second = time2;
       cout << name2 << " came in 2nd with a time of " << second << endl;
   }
   else if (time3 < time2 && time3 > time1)
   {
       second = time3;
       cout << name3 << " came in 2nd with a time of " << second << endl;
   }

   if (time1 > time2 && time1 > time3)
   {
       third = time1;
       cout << name1 << " came in 3rd with a time of " << third << endl;
   }
   else if (time2 > time1 && time2 > time3)
   {
       third = time2;
       cout << name2 << " came in 3rd with a time of " << third << endl;
   }
   else if (time3 > time1 && time3 > time2)
   {
       third = time3;
       cout << name3 << " came in 3rd with a time of " << third << endl;
   }
  
   cout << endl << "Press ENTER to exit...";
   cin.clear();
   cin.sync();
   cin.get();

   return 0;
}
Edit & Run

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote