CS 1160 C/C++ Programming


CS 1160 C/C++ Programming
C/C++ Programming Homework #4

Talent Show Score Calculator
A talent show competition has five judges, each of whom awards a score between 0 and 5 to
each performer (Fractional scores, such as 3.8, 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 getContestantName(string &) should ask the user for the contestant’s name
(please use pass-by-reference)
 double getJudgeData(int) 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 five judges.
o The judge # is passed to present the proper prompt to the user.
o Input Validation: Do not accept judge scores lower than 0 or higher than 5. If the
input is invalid, ask the user to enter the score again.
 double calcScore(double, double, double, double, double) should calculate
and return 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. (You may change the function prototype)
 void displayResult(string, double) should display the contestant’s name and the
calculated final score.
The last two functions, described below, should be called by calcScore, which uses the returned
information to determine which of the scores to drop.

CS 1160作业代写、代做C/C++课程设计作业、c/c++程序语言作业调试
 double findLowest(double, double, double, double, double) should find and
return the lowest of the five scores passed to it. (You may change the function prototype)
 double findHighest(double, double, double, double, double) should find and
return the highest of the five scores passed to it. (You may change the function prototype)
A program running example is shown below:
Enter the contestant's name: Alice Wonderland
Enter judge #1's score: 3
Enter judge #2's score: 4.3
Enter judge #3's score: 3.3
Enter judge #4's score: 5
Enter judge #5's score: 2.5
Contestant Name: Alice Wonderland
After dropping the lowest and highest scores, the average score was 3.5.
CS 1160 C/C++ Programming
Note:
When you write your program, be sure you:
 use meaningful variable names with good style (i.e., useCamelCase)
 use comments (// single-line or /* Multi-line Comment */) at the start of the program, to
label tricky blocks of code, and to explain the contents of variables
 use global constants where appropriate with good style
ALL_CAPS_AND_UNDERSCORES (Put your global constants after your #include
compiler-directives and before your main function definition so they can be found and
changed easily in future versions of your program.)
 format the user interaction nicely. Provide clear instructions to the user.
Submission requirements:
Submit the following files in the e-Learning homework assignment link by the given deadline
(No late program submission will be accepted):
1. source file talentShowScore.cpp (your C++ source code)
2. A screenshot of your program running with the following inputs:
Contestant name: Alice Wonderland
judge score inputs: 3, 3.5, -2, 5, 3.8, 4. (yes, there is one invalid input)

因为专业,所以值得信赖。如有需要,请加QQ99515681 或邮箱:[email protected] 

微信:codehelp

猜你喜欢

转载自www.cnblogs.com/welljava/p/11766836.html