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

Part A: Requirements - DIVE Scoring Program Program language is C# Your mission:

ID: 3762712 • Letter: P

Question

Part A: Requirements - DIVE Scoring Program

Program language is C#

Your mission: 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.

Sample output:

Diver's name: Sue Jones
Diver's city: Dallas
Dive degree of difficulty: 1.9
Invalid degree of difficulty - Please reenter (Valid Range: 1 - 1.67)
Dive degree of difficulty: 2
Invalid degree of difficulty - Please reenter (Valid Range: 1 - 1.67)
Dive degree of difficulty: 1.2

Judge #1 score: 45
Invalid score - Please reenter (Valid Range: 0 - 10)
Judge #1 score: 3
Judge #2 score: 4.5
Judge #3 score 6.7
Judge #4 score 89
Invalid score - Please reenter (Valid Range: 0 - 10)
Judge #4 score 8
Judge #5 score: 9.2

Diver: Sue Jones
City: Dallas
Dive score: 7.68

Do you want to process another dive (Y/N)? y

Diver's name: Dave Smith
Diver's city: Houston
Dive degree of difficulty: 1.1
Judge #1 score: 5.7
Judge #2 score: 6.8
Judge #3 score:: 7.6
Judge #4 score: 8.7
Judge #5 score: 6.7

Diver: Dave Smith
City: Houston
Dive score: 7.74

Tips

Best practice: Note that a good way to implement the code is to write a first version for only a single dive without validating input. Put yourself in the place of the program. What steps would you personally need to perform in order to process a single dive yourself? Write out those steps on paper as pseudocode and/or in Visual Studio as C# comments, and then implement them one by one, testing as you go. After you have a single dive process working, implement one of the input validations, or the outer loop that repeats the whole process. Whichever you choose, remember to not write too much at one time. Always add and test functionality incrementally!

Pseudocode: Although there are several valid ways to write the program, the following is an outline of one way to design the overall logic.

Declare and initialize variables: name, city, judge score, highest score, lowest score, total score
Loop while there are dives to process

Get diver's name and city

Loop to validate input

End Loop

Loop to Validate input

End Loop

Update highest and lowest scores if need be

Add score to total score

End Loop

Calculate the final score (subtract highest and lowest scores from total score, divide by 3, multiply by degree of difficulty)

Display the diver's information and final dive score

Prompt the user if he or she wants to process another dive

End-Loop

Part A: Requirements - DIVE Scoring Program

Program language is C#

Your mission: 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.

Sample output:

Diver's name: Sue Jones
Diver's city: Dallas
Dive degree of difficulty: 1.9
Invalid degree of difficulty - Please reenter (Valid Range: 1 - 1.67)
Dive degree of difficulty: 2
Invalid degree of difficulty - Please reenter (Valid Range: 1 - 1.67)
Dive degree of difficulty: 1.2

Judge #1 score: 45
Invalid score - Please reenter (Valid Range: 0 - 10)
Judge #1 score: 3
Judge #2 score: 4.5
Judge #3 score 6.7
Judge #4 score 89
Invalid score - Please reenter (Valid Range: 0 - 10)
Judge #4 score 8
Judge #5 score: 9.2

Diver: Sue Jones
City: Dallas
Dive score: 7.68

Do you want to process another dive (Y/N)? y

Diver's name: Dave Smith
Diver's city: Houston
Dive degree of difficulty: 1.1
Judge #1 score: 5.7
Judge #2 score: 6.8
Judge #3 score:: 7.6
Judge #4 score: 8.7
Judge #5 score: 6.7

Diver: Dave Smith
City: Houston
Dive score: 7.74

Do you want to process another diver (Y/N)? N

Tips

Best practice: Note that a good way to implement the code is to write a first version for only a single dive without validating input. Put yourself in the place of the program. What steps would you personally need to perform in order to process a single dive yourself? Write out those steps on paper as pseudocode and/or in Visual Studio as C# comments, and then implement them one by one, testing as you go. After you have a single dive process working, implement one of the input validations, or the outer loop that repeats the whole process. Whichever you choose, remember to not write too much at one time. Always add and test functionality incrementally!

Pseudocode: Although there are several valid ways to write the program, the following is an outline of one way to design the overall logic.

Declare and initialize variables: name, city, judge score, highest score, lowest score, total score
Loop while there are dives to process

Get diver's name and city

Get degree of difficulty

Loop to validate input

End Loop


Loop five times to get judges' scores

Loop to Validate input

End Loop

Update highest and lowest scores if need be

Add score to total score

End Loop

Calculate the final score (subtract highest and lowest scores from total score, divide by 3, multiply by degree of difficulty)

Display the diver's information and final dive score

Prompt the user if he or she wants to process another dive

End-Loop

Explanation / Answer

static void Main(string[] args)
{
string dName = "";
string dCity = "";
float judgeScore = 0.0f;
int count = 0;
float highest = 0.0f;
float lowest = 99.0f;
float degreeDifficulty = 0.0f;
Console.WriteLine(" EVENT: Diver Competition ");
Console.WriteLine ("");
Console.WriteLine ("");
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 ");
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}: ");
}
judgeScore += score;
count++;
if (score > highest)
highest = score;
if (score < lowest)
lowest = score;
}
do
{
Console.Write("Enter the degree of difficulty: ");
degreeDifficulty = Convert.ToSingle(Console.ReadLine());
if (degreeDifficulty < 1.00 || degreeDifficulty > 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);
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);
Console.WriteLine ("");
Console.WriteLine ("");
Console.WriteLine ("");
Console.Write (" Press Enter to continue...");
Console.ReadLine();
}
}
}