Here is an example of pseudocode that meets the requirements:
```
// Initialize a counter variable to keep track of the number of games played
gamesPlayed = 0
// Initialize a variable to calculate the salary
salary = 0
// Prompt the staff member to enter 'Yes' for each game played
FOR i = 1 TO 10
PRINT "Did the junior player play a game? (Yes/No): "
READ input
// Validate the input
WHILE input is not 'Yes' or 'No' DO
PRINT "Invalid input! Please enter 'Yes' or 'No': "
READ input
END WHILE
// Increment the counter if the game was played
IF input is 'Yes' THEN
gamesPlayed = gamesPlayed + 1
END IF
END FOR
// Check if the player is eligible for a bonus
IF gamesPlayed >= 10 THEN
PRINT "The player is eligible for a bonus!"
ELSE
PRINT "The player is not eligible for a bonus."
END IF
// Calculate the salary
salary = gamesPlayed * 24000
// Display the salary to the user
PRINT "The player's salary is: R" + salary
// Confirm with the user whether they are eligible for a bonus or not
PRINT "Are you eligible for a bonus? (Yes/No): "
READ bonusEligible
// Validate the input
WHILE bonusEligible is not 'Yes' or 'No' DO
PRINT "Invalid input! Please enter 'Yes' or 'No': "
READ bonusEligible
END WHILE
// Display the final confirmation message
IF bonusEligible is 'Yes' THEN
PRINT "Congratulations! You are eligible for a bonus."
ELSE
PRINT "Sorry, you are not eligible for a bonus."
END IF
```
Note: This pseudocode assumes that the user will always enter the correct number of games played (10 in this case) and will only enter 'Yes' or 'No' as valid inputs. You may need to modify the pseudocode to handle any additional input validation or error checking that is required.
Q.2.1 It was decided that if a junior soccer player (under 18) has played at least 10 games
during the year they will get a R5000 bonus. Each junior player earns a basic rate
of R24 000 per game that they play.
Using pseudocode, plan the logic for an application that will:
- Allow a staff member to enter ‘Yes’ for every game played.
- Count the number of times the user entered the value ‘Yes’.
- Determine if the player is eligible for a bonus.
- Calculate and display the salary of a player.
- Confirm with the user whether they are eligible for a bonus or not.
- Include at least four (4) meaningful comments.
1 answer