Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / I need the flowchart for this code   that's it

I need the flowchart for this code   that's it

Computer Science

I need the flowchart for this code

 

that's it..

 

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 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 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.

• float findLowest() should find and return the lowest of the five scores passed to it.
• float findHighest() should find and return the highest of the five scores passed to it.

Note: Utilize input validation: Do not accept judge scores lower than 0 or higher than 10.

 

 

To be submitted:

  • Flowchart of your program design using draw.io.Program in cpp:
//header files
#include<iostream>
using namespace std;

//function to get the judge score
double getJudgeData(){
	//variable to store the judge score
	double score;
	cout<<"Enter the score: ";
	//loop until user enter a valid score
	do{
		cin>>score;
		//for invalid values show the error message
		if(score<0 || score>10){
			cout<<"Invalid ChoicenEnter again: ";
		}
		else{
			//accept the score by exiting the loop for valid value
			break;
		}
	}while(1);
	//returning the entered score
	return score;
}//end of function

//function to find the lowest value
double findLowest(double s1,double s2,double s3,double s4,double s5){
	//marking the first score as the smallest value
	double smallest=s1;
	
	//compare smallest with the other values and reassign the smallest value if required
	if(s2<smallest)
		smallest=s2;
	if(s3<smallest)
		smallest=s3;
	if(s4<smallest)
		smallest=s4;
	if(s5<smallest)
		smallest=s5;
	
	//returning the smallest value
	return smallest;
}//end of function

//function to find the lowest value
double findHighest(double s1,double s2,double s3,double s4,double s5){
	//marking the first score as the smallest value
	double highest=s1;
	
	//compare smallest with the other values and reassign the smallest value if required
	if(s2>highest)
		highest=s2;
	if(s3>highest)
		highest=s3;
	if(s4>highest)
		highest=s4;
	if(s5>highest)
		highest=s5;
	
	//returning the smallest value
	return highest;
}//end of function

//function to calculate and return the score
double calcScore(double s1,double s2,double s3,double s4,double s5){
	//finding the highest score
	double highest=findHighest(s1,s2,s3,s4,s5);
	//finding the lowest score
	double lowest=findLowest(s1,s2,s3,s4,s5);
	
	//showing the lowest and the highest scores
	cout<<"Lowest score: "<<lowest<<endl;
	cout<<"Highest score: "<<highest<<endl;
	
	//finding the sum of the 3 average scores after subtracting the highest and the lowest
	double sum=s1+s2+s3+s4+s5-highest-lowest;
	
	//returning the average of the 3 scores
	return sum/3;
}//end of function

//main function to test the logic
int main(){
	
	//variable for the scores of 5 judges
	double score1,score2,score3,score4,score5;
	
	//getting the input for the judge data
	score1=getJudgeData();
	score2=getJudgeData();
	score3=getJudgeData();
	score4=getJudgeData();
	score5=getJudgeData();
	
	//calculating the contestant score
	double score=calcScore(score1,score2,score3,score4,score5);
	//printing the contestant score
	cout<<"The contestant final score is: "<<score<<endl;
	
	//returning from main
	return 0;
}//end of main

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions