Programming Challenge: CHAPTER 6 PC 12 - Star Search, now with arrays! Modify this program and its functions to use arra

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Programming Challenge: CHAPTER 6 PC 12 - Star Search, now with arrays! Modify this program and its functions to use arra

Post by answerhappygod »

Programming Challenge: CHAPTER 6 PC 12 - Star Search, now witharrays!
Modify this program and its functions to use arrays instead ofindividual variables to contain the scores. This means that thefunctions that once received five scores will now receive as theirparameters the name of the array and the size of that array. Forexample, one of the prototypes will be:
double getSmallest(const double theScores [], intnumScores);
The only place in your code where the number 5 will appear iswhen you declare the number of scores (which will be size of thearrays) in the main function. Change that lone 5 to, say, a 10, andyour program should request and process 10 scores. Try it and makesure that works before you submit your program!
Also note that the getJudgeData() function and theaccompanying validation function are reused exactly asthey were in the previous assignment. Do not change thesefunctions at all! Sure, you can send a referenceto an array element. Why not?
Deliverables:
The .cpp file and a screen shot of this Programming Challenge inaction.
Enter the following five scores for your screen shot:
10
8.8
12 (rejected, try again!)
10 (that's better...)
6.6
9.9
Your answer to the above should be 9.57. If it isn't, you'vedone something wrong. As per our usual practice, the final answershould be shown with two digits after the decimal point.Do not use a global variable for the sizeparameter; this should be a const int in the mainfunction.
Do not use pointer notation; keep to thestyle of code we have learned in this course.
As before, there should not beany cin or cout statements in the mainfunction.
Programming Challenge Chapter 6 Pc 12 Star Search Now With Arrays Modify This Program And Its Functions To Use Arra 1
Programming Challenge Chapter 6 Pc 12 Star Search Now With Arrays Modify This Program And Its Functions To Use Arra 1 (151.4 KiB) Viewed 31 times
12. Star Search A particular talent competition has five 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 aver- aging the three remaining scores. Write a program that uses this method to calculate a contestant's score. It should include the following functions: • void getJudgeData() 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. • 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 functions, described below, should be called by calcScore, which uses the returned information to determine which of the scores to drop. • int find Lowest() should find and 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.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply