Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please use Pseudocode Project in a nutshed: Determine the of a set of numbers af

ID: 3583744 • Letter: P

Question


Please use Pseudocode

Project in a nutshed: Determine the of a set of numbers after eliminating the smallest and values from the The next winter olympics is two years away, but the International olympic committee ooc) wants you to develop a computer system that will determine the trimmed or truncated mean of the scores from a judging panel used for olympic skating events. The specrfic truncated mean that the oc nequires sthe average of the remaining scores, after the lowest and hghest scores have been discarded. Your solution can assume there are seven judges, and the final result will be the average of the five middle scores The system architect for this project has produced ahighlevel desgn by functionally decomposing the overall task into the following mainline and major subtasks: Module descriptions The manline coordinates the activities of the major subtasks. Mainline s Allow the user or upstream process to input the scores, one at a tme, and return them to the mainline in an array he scores, find and return the smalest value. Find min FInd Given the scorek find and return the largest value. Given the scores, along with the smallest and largest values, calculate the required truncated average. truncated mean output all of the scores along with the truncated mean ar Alice, complete solutiord wil have sbo separate pseudocode, flowcharts You may submit a solution in modules, per the functional decompositio For pseudocode and flowcharts, assume that an array can be an explct return vaue That use: array Nome to return an array to the calling code, where amayName is the identifier of the array variable. Assume that an array be passed into a module by using ts name in the parameter list. For example the following Ilustrates the instruction that calls the module might look like finalscere a calculateTruncatedMeangsoores, smallest, largest) scores is the holdng the scores, and wmatest and largest are the min and maa scores, respectively, Note that for both return vakes and arguments, the array name is used without square brackets nclude the brackets and the when an array declared as a formal parameter,

Explanation / Answer

Mainline : coordiantes the activities of the subtasks .

basically , what this means is we are looking to create a module , which will hold the records of all games ( denoted as subtasks ) in multiple arrays ( arrayname will denote the game's name which will hold the all scores)

Get Scores : this module will, allow the user to input scores one at a time , of a particular game at one time. this will then send this score array to the mainline function for maintaince .

Find min/nax : this will take the score array of a particular game as a parameter, and return the min or max scores for that game.

Calculate Truncated Mean : this module, will basically calculated a trimmed mean of the scores of a particular game. here , we need to subtract the largest and the smallest scores taken in as a parameter and then calculate the mean, which will be our truncated mean.

Report : this module will simply output the scores of a particulaar game, along with the mean. The array for the scores of that game will be taken in as a parameter.

-----------------------------------------------

to calculate min of an array , we will do the following ,

1. initialize a min variable to a very large number ( such that all possible scores are lesser than it )

2. traverse the score array and compare min to array[i]

if min > array [i] let min = array[i]

3. do this for all array elements.

final value of min is the smallest element in the array.

for MAX :

1. initialize a max variable with a very small number ( such that all possible scores are greater than it )

2. traverse the score array and compare max to array[i]

if max < array [i] let max = array[i]

3. do this for all array elements.

final value of max is the greatest element in the array.

---------------------------------------------------------------

to calculate the truncated mean

1. calculate the sum of all scores in that array.

2. subtract the smallest and largest element from this sum.

3. divide by the number of scores to get the final mean.

------------------------------------------------------------------------------------------------

psuedo code ---

-----------------------------------------------------------------------------------------------

get_score()

{

declare array[]

i=0

input=1

while(input)

{

array[i] = input score

i++

print("do you wish to continue 1 or 0" )

scan(input) //if input is 1 we take more user values , if 0 we quit

  

}   

return array

}

mainline ()

{

print("select the game for which you must enter scores " )

//print all games whose score arrays are declared as game[] (example int basketball[] etc )

game = get_scores() // this "game" is based on what the user selected above, use switch case, or basic if else for this.

}

find_min( array )

{

size = len(array)

min = infinity (large number like 10000000000000)

while(size--)

{

if(min> array[i])

{ min=array[i]

}

}

return min;

}

find_max( array )

{

size = len(array)

max = -infinity (small number like -10000000000000)

while(size--)

{

if(max < array[i])

{ max=array[i]

}

}

return max;

}

truncated_mean(array , smallest, latgest)

{

double sum = 0;

  

size = len(array)

while(size--)

{

sum = sum + array[size]

}

sum = sum - smallest - largest

return sum/size //mean = sum of all values/number of values

}

report ( array , mean )

{

size = len(array)

i=0

while( i < size)

{

print " scores are "

print array[i]

i++

}

print " the mean is "

print mean

}

-------------------------------------------------------------------

driver program for these modules

-------------------------------------------------

main()

{

print " select your game to input "

mainline() //calls get scores internally

print " to find max of which game"

scan(array) ///user enters the game

int max = fin_max(array)

//similarly for min

int min = find_min(array)

//to calculate mean

double output = truncated_mean(array , min, max)

//to output

report(array, mean)

}