0

Here is what I have so far
Many professional sports teams use a computer to assist in the analysis of scouting reports on prospective players. The Kute and Kuddly soccer team is in need of such a system. You are to design an algorithm to accept the scouting data from the user, calculate the player's evaluation figure, and print a line on a report giving the player's data and evaluation figure.

You are also to identify the name and evaluation of the player with the highest evaluation figure after finishing the rest of the report.

The input data for this algorithm consists of the player's name, age, goals, assists, and league factor(real number). Calculate the evaluation figure as follows:

eval = (age + (goals + assists)/4 ) * league factor

Use the player name 'Done' as the sentinel value to end the program.


Function GetName()
Return – String
Narrative Description : Ask for the user for a name, and done when finished

Local variable lname – string
1) Print(“Enter the player name and enter done when finished:”)
2) Read(lname)
3) Return(lname)
Procedure GetRest(page,pgoals,passists,pleague_factor)
1. Print(“Please enter the players age, number of goals, number of assist, and league factor:”)
2. Read(page, pgoal, passists, pleague_factor)
3. Return

Function CalcEvaluation(page,pgoals,passists,pleague_factor)
Returns – real
Narrative Description : Calculate the evaluation figure when given the player’s age, goal, assist, and league factor
Local variable leval_figure – real
1. leval_figureß (page + (pgoals + passists)/4 ) * pleague_factor
2. Return (leval_figure)
Function DispDetail(pname, page, pgoal, passists, pleague_factor, peval_figure)
Returns – nothing
Narrative Description : Display the players data, name, age, goal, assists, league factor, and evaluation figures
1. Print(pname, page, pgoal, passists, pleague_factor, peval_figure)
2. Return()


1. NameßGetName()
2. While(name <>”done”)do
3. Call GetRest(age, goal, assists, league_factor)
4. eval_figureß CalcEvaluation(page,pgoals,passists,pleague_factor)
5. DispDetail(name, age, goal, assists, league_factor, eval_figure)
6. Nameß GetName()
Endwhile
I dont understand how to get the highest percentage and display the name and that percentage of evaluation figure

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by Terry Robinson
0

You need a global variable which maintains the highest score seen so far which is updated in your While loop. Be sure to preset it to zero. You could also add additional global variables to save the name when a new high score was encountered

Global variable highscore, HighName
Highscore = 0
HighName = ''

1. NameßGetName()
2. While(name <>”done”)do
3. Call GetRest(age, goal, assists, league_factor)
4. eval_figureß CalcEvaluation(page,pgoals,passists,pleague_factor)
if eval_figure > highscore then
highscore = eval_figure
HighName = Name
endif
5. DispDetail(name, age, goal, assists, league_factor, eval_figure)
6. Nameß GetName()
Endwhile

print(Highname, Highscore)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.