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

Before starting. I have viewed so far in my class the following: Bubble Sort, Se

ID: 3558006 • Letter: B

Question

Before starting. I have viewed so far in my class the following:

Bubble Sort, Selection Sort, Sequential Search, Binary Search, Structs, and Pointers. Therefore, it will be helpful to use any of these to run a program for the following:

PART A

In a gymnasitics or diving competition, each contestant's score is calculated by dropping the lowest and highest scores and then adding the remaining scores. There are five gymnast that are competing in the competition. Write a program taht allows user to enter judge's scores and output the AVERAGE points received by each contestants. (a judge awards points between 1 and 10, with 1 being the lowest and 10 being the highest). A sample output is:

GYMNAST                       AVERAGE POINTS RECEIVED

Johnson                           9.8

Miller                               8.9

Duffy                               9.2

Robinson                         7.0

Ashton                             9.0

Total                                9.4

The winner of the competition is Johnson

PART B

After displaying the gymnast's name and points received by each gymnast, your program will use selection sort and display gymnast who received the highest to lowest points.

PART C

After correction, it was discovered that Robinson received 2.1 more points than recorded. Use binary search to find Robinson and update his points total. It was also reported that MIller's final vote count is 9.0 and not 8.0. Use binary search to find MIller and update his final vote count as well. Display the final results. Sorted and updated.

Explanation / Answer

#include <stdio.h>
#include<iostream>
using namespace std;
int main()
{
       string Cname;
int p=0,position,Lposit;
double pointsavg[100];
   double maxScore = 0.0, minScore = 0.0, sumScore = 0.0,scoreAvg = 0.0, totalScore = 0.0,Uscore ;
   // used to store 8 scores from 8 judges, reset all to 0
   // else rubbish will be stored....
   double num[8] = {0};
   int i=0, j=0, stop = 0;
   string name[100];
   while(stop != -1)
   {
   cout<<"Enter Player name ";
    cin>>name[p];
       // prompt user for inputs
       cout<<"Enter 8 scores out of ten points separated by a space: ";
       // store all the input in num[]
       for(i=0;i<8;i++)
       {
       // using %f is failed, use lf instead for double
           cin>>num[i];
       // sum up all the score
           sumScore = sumScore + num[i];
       }

       // set initial value minScore to the first array element
       minScore = num[0];
       // iterate, compare for max and min score and store them
       for(j = 0;j< 8; j++)
       {   
           if( minScore > num[j])
           {
               minScore = num[j];
           }
           if( maxScore < num[j])
           {
               maxScore = num[j];
           }
       }

       // discard the lowest and highest scores
       totalScore = sumScore - (maxScore + minScore);
       // find the average score, the number of scores = 8.0

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