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

Can I get some help making this C++ program. When it says \"your program should

ID: 3670634 • Letter: C

Question

Can I get some help making this C++ program. When it says "your program should implement functions that perform the following tasks" it means that each of the bullets from that must be their own function.

Working With Functions in C++ You have been selected to write a program to calculate the scores for a local diving competition. There are 6 judges who are rating each diver on a scale of 1 to 10. Scores can be entered up to 2 decimal places. You are going to write a program that will read in the scores and determine the average score. Your program will also determine the highest and lowest score given to each diver. 1. Your program should implement functions that perform the following tasks Accept the data-function should prompt the user for the judge's score. Error checking should validate that it is in the range of 1 to 10. The function should be called for each of the scores Determine the highest score -return the highest score of all the scores passed to the function Determine the lowest score-return the lowest score of all the scores passed to the function Average the scores - display the average score of all the scores passed to the function. · Keep the following points in mind when creating your program: Output should be labeled, aligned, and formatted to 2 decimal places. Do not use global variables in your program Make sure you are using the correct data types and descriptive variable names. Add a comment to the top of your program that includes your name, the program name, and a description of the program code. Include descriptive comments throughout your program. Test your calculations! ·

Explanation / Answer

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

int main ()
{
   //variable declarations
   double finalScore = 0.0;
   int numberOfDivers = 0;
  
   //output report heading
   cout << "Report to the media." << endl;
   cout << "Event: Diving Competition " << endl;

   //initialize and begin loop allowing user option of processing more divers
   char processDiver = 'y';
   while (processDiver == 'y' || processDiver == 'Y')
   {
       cout << "----------------------------------------------------" << endl;
       cout << " Enter diver's name: ";
       string diverName;
       getline(cin, diverName);
       cout << "Enter diver's city: ";
       string diverCity;
       getline(cin, diverCity);

       //initialize highestScore, lowestScore, and totalScore
       double highScore = 0.0;
       double lowScore = 11.0;
       double totalScore = 0.0;

       //use do...while loop to process the scores of 5 judges
       int count = 0;
       do
       {
           cout << "Enter score of judge #" << count + 1 << ": ";
           double judgeScore = 0.0;
           cin >> judgeScore;
           while (judgeScore < 0 || judgeScore > 10)
           {
               cout << "Invalid Score! Enter score between 0 to 10." << endl;
               cout << "Enter sore of judge #" << count + 1 << ": ";
               cin >> judgeScore;
           }
          
           //total up judgeScore and determine highestScore and lowestScore
           totalScore += judgeScore;
           if (judgeScore > highScore)
               highScore = judgeScore;
           if (judgeScore < lowScore)
               lowScore = judgeScore;

           //increment counter
           count++;
       } while (count < 5);

       //prompt user to input degree of difficulty and validate input
       cout << "Enter degree of difficulty (1.00 to 1.67): ";
       double degreeOfDifficulty = 0.0;
       cin >> degreeOfDifficulty;
       while (degreeOfDifficulty < 1.00 || degreeOfDifficulty > 1.67)
       {
           cout << "Invalid Input!" << endl;
           cout << "Enter degree of difficulty (1.00 to 1.67): ";
           cin >> degreeOfDifficulty;
       }

       //calculate diver's overallScore
       double overallScore = 0.0;
       totalScore -= highScore;
       totalScore -= lowScore;
       overallScore = (totalScore / 3) * degreeOfDifficulty;

       //display diver's information and overallScore
       cout << " Diver: " << diverName << endl;
       cout << "City: " << diverCity << endl;
       cout << setprecision(2) << fixed;
       cout << "Overall Score: " << overallScore << endl;

       //add diver's overallScore to finalScore and increment numberOfDivers
       finalScore += overallScore;
       numberOfDivers++;

       //prompt user to process another diver
       cout << " Would you like to process another diver (Y/N)?";
       cin >> processDiver; //take a look at this during debugging. May need to validate input.
       cin.ignore();//Check this
   }

   //calculate averageScoreAllDivers. Display numberOfDivers and averageScoreAllDivers.
   cout << "----------------------------------------------------" << endl;
   cout << " EVENT SUMMARY " << endl;
   double averageScoreAllDivers = 0.0;
   averageScoreAllDivers = finalScore / numberOfDivers;
   cout << setprecision(2) << fixed;
   cout << "Number of divers: " << numberOfDivers << endl;
   cout << "Average score of all divers: " << averageScoreAllDivers << endl;

   return 0;
}

output

Report to the media.                                                                                                                                        
Event: Diving Competition                                                                                                                                   
                                                                                                                                                            
----------------------------------------------------                                                                                                        
                                                                                                                                                            
Enter diver's name: ram                                                                                                                                     
Enter diver's city: delhi                                                                                                                                   
Enter score of judge #1: 3                                                                                                                                  
Enter score of judge #2: 6                                                                                                                                  
Enter score of judge #3: 7                                                                                                                                  
Enter score of judge #4: 8                                                                                                                                  
Enter score of judge #5: 5                                                                                                                                  
Enter degree of difficulty (1.00 to 1.67): 1.00                                                                                                             
                                                                                                                                                            
Diver: ram                                                                                                                                                  
City: delhi                                                                                                                                                 
Overall Score: 6.00                                                                                                                                         
                                                                                                                                                            
                                                                                                                                                            
Would you like to process another diver (Y/N)?n                                                                                                             
----------------------------------------------------                                                                                                        
                                                                                                                                                            
                EVENT SUMMARY                                                                                                                               
                                                                                                                                                            
Number of divers: 1                                                                                                                                         
Average score of all divers: 6.00                                                                                                                           

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