The state diving commission wants to computerize the scoring at its diving compe
ID: 3633078 • Letter: T
Question
The state diving commission wants to computerize the scoring at its diving competitions. You've been hired to write a program to automate the scoring of dives. Following are the requirements for the program.After each dive, the user will be prompted to enter the:
diver's name;
diver's city;
degree of difficulty (ranges from 1.00 to 1.67); and
scores from five judges (scores can range from 0 to 10).
If an invalid score is entered, an error message will be displayed. The user will be prompted for the score repeatedly until a valid score is entered.
The program will then display the following information:
Diver's name
Diver's city
Dive final score: This is calculated by dropping the highest and lowest of the five judges' scores. The remaining three scores are added together, and the result is divided by 3 and then multiplied by the degree of difficulty.
The program will then prompt the user if she/he wants to process another dive. The user can type "Y" or "y" to continue, and "N" or "n" to quit.
Explanation / Answer
static void Main(string[] args) { // Data Dictionary string dName = ""; string dCity = ""; float judgeScore = 0.0f; int count = 0; float highest = 0.0f; float lowest = 99.0f; float degreeDifficulty = 0.0f; // Event Name Console.WriteLine(" EVENT: Diver Competition "); Console.WriteLine (""); Console.WriteLine (""); // Enter Diver's Name, City Console.Write (" Please Enter Diver's Name: "); dName = Console.ReadLine(); Console.Write (" Please Enter Diver's City: "); dCity = Console.ReadLine(); Console.WriteLine(" Judges Please Enter Your Score Value's: 0 - 10 "); // Enter Judges Score for (short i = 0; i < 5; i++) { Console.Write("Enter Score For Judge #{0}: ", i + 1); float score = float.Parse(Console.ReadLine()); if (score < 0 || score > 10) { Console.Write("Invalid Score -- Please Re-enter " + "(Valid Range: 0 - 10)"); Console.Write("Enter Score For Judge #{0}: "); } // accumulation judgeScore += score; // count count++; // The Highest Score if (score > highest) highest = score; // The Lowest Score if (score 1.67) { Console.WriteLine("Invalid degree of difficulty - Please reenter " + "(Valid Range: 1.00 - 1.67) "); Console.WriteLine("Enter the degree of difficulty: "); degreeDifficulty = Convert.ToSingle(Console.ReadLine()); } } while (degreeDifficulty < 1.00 || degreeDifficulty > 1.67); // Display Overall Score Console.WriteLine(""); Console.WriteLine(" - - - - - - - - - - - - - - - - - "); Console.WriteLine("- - - - - - - - - - - - - - - - - -"); Console.WriteLine(" - - - - - - - - - - - - - - - - - "); Console.WriteLine(" Diver: " + dName + " City: " + dCity); Console.WriteLine(" Degree Of Diffuculty; {0}", degreeDifficulty); Console.WriteLine(" Overall Score is: {0:f2}", (judgeScore - highest - lowest) / 3 * degreeDifficulty); // Spaces Console.WriteLine (""); Console.WriteLine (""); Console.WriteLine (""); // pause Console.Write (" Press Enter to continue..."); Console.ReadLine(); } } }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.