- #1
Travian
- 64
- 0
Homework Statement
In 2014 Fifa (the world governing body for international football) would like to revise the way teams are allocated points for the group stage of the World Cup as shown below:
Result Points
Win 3
Draw 1
Lose 0
Win (with penalty shootout) 2
Lose (with penalty shootout) 1
Design an algorithm using pseudocode that analyses the result of a match and awards points to the two teams accordingly.
Homework Equations
The Attempt at a Solution
Algorithm
Code:
Declare firstTeamGoals, secondTeamGoals, firstPen, secondPen as integer
Write “Please enter first team amount of goals”
Get firstTeamGoals ;
Write “Please enter second team amount of goals”
Get secondTeamGoals ;
IF (firstTeamGoals > secondTeamGoals) THEN
Write “First team receives 3 points and second team receives 0 points”
ELSEIF (firstTeamGoals < secondTeamGoals) THEN
Write “First team receives 0 points and Second team receives 3 points”
ELSE
IF (firstTeamGoals == secondTeamGoals)
Write “Please input the number of scored penalties (first team)”
Get firstPen ;
Write “Please input the number of scored penalties (second team)”
Get secondPen ;
IF (firstPen > secondPen) THEN
Display “First team receives 2 points and second team receives 1 point”
ELSE
Display “First team receives 1 point and second team receives 2 points”
ENDIF
ENDIF
ENDIF
I just want someone to confirm is this right. If not - where's the problem. Thank you.