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

Hello, Can you please help me with this? Develop a C++ program to provide inform

ID: 3918903 • Letter: H

Question

Hello,

Can you please help me with this?

Develop a C++ program to provide information regarding a recent downhill ski competition. Have the user enter the full names and times of the skiers and determine the fasted speed (lowesttime), average speed, look up a skier’s time, and display the skiers’ names and times.

Name

Time

Leela Neela

2.03

Sarah Hara

2.40

Anna Banana

1.85

Keesha Fleesha

1.90

Heidi Mighty

2.50

Requirements:

In main, define two parallel arrays and have the user enter the skiers’ names and times, and store them in the two parallel arrays (validate that the times are greater than zero).

Do NOT use global variables. The arrays must be passed to all appropriate functions as arguments and used in the functions to produce the results.

Variable names must be descriptive and initialized where required.

Create a menu to ask the user if they want to:

Determine the fastest skier

Calculate the average time

Find the time of a skier

Display the skiers and their times

Quit the program

Display the menu repeatedly in main and have functions for each of the first four menu items.

The four functions will be:

Determine and display the fastest skier and her time

Calculate and display the skiers’ average time

Find a skier: have the user enter a skier’s full name in this function, then search for the skier, and display her name and associated time; if the user enters a name that is not in the array, display a message to let the user know the name is not in the list.

Display all the skiers and their times

Output must be labeled and easy to read.

Arrays must be processed using loops.

Program must be documented with the following:

// Name

// Date

// Program Name

Name

Time

Leela Neela

2.03

Sarah Hara

2.40

Anna Banana

1.85

Keesha Fleesha

1.90

Heidi Mighty

2.50

Explanation / Answer

ScreenShot

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

Program

/* Name
Date
Program Name*/
//Header file for I/O, string read and write and precision set
#include<string>
#include<iostream>
#include <iomanip>
using namespace std;
//Function prototype
void menu();
void displayFastestSkyer(string name[],double time[],int size);
void calculateAverageTime(double time[], int size);
void skyerTime(string name[], double time[], int size,string sname);
void display(string name[], double time[], int size);
int main()
{
   //Variable for choice
   int ch;
   //Skyer time check
   string sName;
   //Arrays to keep Skyer name and time
   string name[] = { "Leela Neela","Sarah Hara","Anna Banana","Keesha Fleesha","Heidi Mighty" };
   double time[] = { 2.03,2.40,1.85,1.90,2.50 };
   //Call menu function
   menu();
   //Prompt user for choice
   cout << "Enter your choice: ";
   cin >> ch;
   //Operate according to the choice
   while (ch<=5 && ch>0) {
       switch (ch) {
           //Call fastest skyer function to get fastest skyer
       case 1:
           displayFastestSkyer(name,time,5);
           break;
           //Call function to calculate average sky time
       case 2:
           calculateAverageTime(time,5);
           break;
           //call a function to find a skyer time
       case 3:
           cin.ignore();
           cout << "Enter skyer's full name: ";
           getline(cin, sName);
           skyerTime(name,time,5,sName);
           break;
           //Display skyerdetails
       case 4:
           display(name,time,5);
           break;
           //Exit from program
       case 5:
           cout << "Good Bye!!" << endl;
           exit(0);
       }
       //Repeat menu
       menu();
       cout << "Enter your choice: ";
       cin >> ch;
   }
   //choice error
   cout << "You entered choice is wrong!!!.Run application again!!!" <<endl;
    return 0;
}
//Display menu function
void menu() {
   cout << "1.Determine the fastest skier 2. Calculate the average time 3. Find the time of a skier 4. Display the skiers and their times 5. Quit the program" << endl;
}
//Display fastest skyer
void displayFastestSkyer(string name[], double time[],int size) {
   double min = time[0];
   for (int i = 0; i < size; i++) {
       if (time[i]<min) {
           min = time[i];
       }
   }
  
   for (int i = 0; i < size; i++) {
       if (min == time[i]) {
           cout << name[i] << "is the fastest skyer with the speed of " << time[i] << " time!!!" << endl << endl;;
       }
   }
}
//Display skying average time
void calculateAverageTime(double time[], int size) {
   double avg = 0;
   for (int i = 0; i < size; i++) {
       avg += time[i];
   }
   avg = avg / size;
   cout << fixed << setprecision(2) << "Average Time= " << avg << endl<<endl;
}
//Display skyer time
void skyerTime(string name[], double time[], int size,string sname) {
   for (int i = 0; i < 5; i++) {
       if (name[i] == sname) {
           cout << "Skyer " << sname << " takes " << time[i] <<" time!!"<<endl<<endl;
           return;
       }
   }
   cout << sname << " is not present in the list!!!" << endl << endl;
}
//Display all skyer's details
void display(string name[], double time[], int size) {
   cout << "Skyer Name                Time Taken --------------------------------------" << endl;
   for (int i = 0; i < size; i++) {
       cout << std::left<<std::setfill(' ') << std::setw(30) << name[i] << time[i] << endl;
   }
   cout << endl;
}

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

Output

1.Determine the fastest skier
2. Calculate the average time
3. Find the time of a skier
4. Display the skiers and their times
5. Quit the program
Enter your choice: 1
Anna Bananais the fastest skyer with the speed of 1.85 time!!!

1.Determine the fastest skier
2. Calculate the average time
3. Find the time of a skier
4. Display the skiers and their times
5. Quit the program
Enter your choice: 2
Average Time= 2.14

1.Determine the fastest skier
2. Calculate the average time
3. Find the time of a skier
4. Display the skiers and their times
5. Quit the program
Enter your choice: 4
Skyer Name                Time Taken
--------------------------------------
Leela Neela                   2.03
Sarah Hara                    2.40
Anna Banana                   1.85
Keesha Fleesha                1.90
Heidi Mighty                  2.50

1.Determine the fastest skier
2. Calculate the average time
3. Find the time of a skier
4. Display the skiers and their times
5. Quit the program
Enter your choice: 5
Good Bye!!
Press any key to continue . . .

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