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
C++ Dos and Donts for this Assignment
You are expected to use the content from chapters 1 - 6 (expressions, I/O, loops, conditionals, and functions). You are not to use arrays (chapter 7) or other advanced features to solve this problem.
A particular talent competition has five judges, each of whom awards a socre 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 three remaining scores. Write a program that uses this method to calculate a contestant's score. It should include the following functions:
- void getJudgeDate() should ask the user for a judge's socre, store it in a reference parameter varialbe, and validate it. This function should be called by main once for each of the five judges.
- void calcScore() should calculate and display the average of the three 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 five scores.
The last two fuctions, described below, should be called by calcScore, which uses the returned information to determine which of the scores to drop.
- int findLowest() should find the return the lowest of the five scores passed to it.
- int findHighest() should find and return the highest of the five scores passed to it.
Input validation: Do not accept judge scores lower than 0 or higher than 10.