Homework Help Global logo
  • Home
  • Coursework Help
  • Dissertation Help
  • Homework Help
  • My account
  • Order now
Order Now
Homework Help

A talent competition | Computer Science homework help

3 min read
Posted on 
August 22nd, 2022
Home Homework Help A talent competition | Computer Science homework help

A talent competition has 5 judges, each of whom awards a score
Resolved Question:
A talent competition has 5 judges, each of whom awards a score between 0 and 10 to each performer. Fractional scores, such as 8.3 are allowed. A performer’s final score is determined by dropping the highest and lowest score received, then averaging the 3 remaining scores. Write a program that uses this method to calculate a contestant’s score. It should include the following functions:

void getJudgeData() — This should ask the user for a judge’s score, store it in a reference parameter variable, and validate it. This function should be called by main once for each of the 5 judges.

void calcScore() — This should calculate and display the average of the 3 scores that remain after dropping the highest and lowest scores the performer received. This function should be called just once by main, and should be passed the 5 scores.

The last two functions, described below, should be called by calcScore, which uses the returned information to determine which of the scores to drop.

int findLowest() — This should find and return the lowest of the 5 scores passed to it.

int findHighest() — This should find and return the highest of the 5 scores passed to it.

Finally, Input Validation: Do not accept judge scores lower than 0 or higher than 10.

EXTRA!!!!!!
____________________________________________________________________

Your task is to create a modified version of the Star Search program (Chapter 6 problem #11). To understand the modifications use the following instructions:

1. Read the current Star Search program statement

2. Add the following specifications to the Star Search program description

Your program will have an input file that will consist of a list of contestants. The first line of the file is an integer that says how many contestants are in the file. Each line is for one contestant and each line in the file would have the following format (the name of the input file starsearch.dat):
Contestant Name(no spaces) score1 score2 score3 score4 score5

Your program will have a function called string contestantName() that takes the file object as a reference parameter and reads the file for the name of the contestant on the current line and returns the name. This function should be called from main, once for each line of the file.
The void getJudgeData() will read from the file and not from the user. This function will still use a reference parameter for the score, and it will read the next score from the file. This function will be called five times per contestant and is called from main once for each score.
The void CalcScore() is used to calculate the score using the same formulation. However, this function will write the contestants name and score to an output file. The function will have 7 parameters instead of 5: output file (pass by reference), contestants’ name, and the 5 judges scores.
Error in the books specification: findLowest() and findHighest() should return double and not int.
Note: You are not allowed to use arrays
The output file will be a list of contestants, where each line has the following format (name the output file results.dat):
Contestant Name(name contains no spaces) Final_Score

In summary, the program is the same as the original version with the additional features: input file, output file, and more than one contestant. This causes the changes in the functions for input and output. The findLowest and findHighest functions are still needed as stated in the original description.

SAMPLE INPUT FILE

2
Jennifer 10 9 8 9.5 10
Michael 10 9 10 9 10

SAMPLE OUTPUT FILE

Jennifer 9.50 Michael 9.67

Order an Essay Now & Get These Features For Free:

Turnitin Report

Formatting

Title Page

Citation

Outline

Place an Order
Share
Tweet
Share
Tweet
Calculate the price
Pages (275 words)
$0.00
Homework Help Global
Company
  • Coursework Help
  • Law Homework Help
  • Business Paper Help
  • Thesis Writing Help
Legal
  • Dissertation Help
  • Homework Help
  • Essay Writing
  • Custom Writing
How Our Service is Used:
Homework Help Global essays are NOT intended to be forwarded as finalized work as it is only strictly meant to be used for research and study purposes. Homework Help Global does not endorse or condone any type of plagiarism.
Subscribe
No Spam
© 2023 Homework Help Global. All rights reserved.
Homework Help Global will be listed as ‘Homework Help Global’ on your bank statement.