A computer game is designed for users to select characters. Each character can take part in a group of events. Each group has five events. There are four types of event: jump, swim, run, drive. The program is written using object-oriented programming. The method CalculateScore() in the Character class calculates and returns the percentage chance of a character completing an event. When a character's skill level is greater than or equal to the difficulty of that event, the percentage chance of completing the event is $$\(100 \%\)$$. When a character's skill level is less than the difficulty of that event, the character's skill level is subtracted from the difficulty of that event. This difference is used to identify the percentage chance of success using this table: For example: - A character has a skill level of 3 for events of type run. - An event of type run has a difficulty level of 5 - The character's skill level is less than the difficulty, therefore the difference is calculated. - The difference is the character's skill level subtracted from the event difficulty, 5-3=2 - The difference is 2 , therefore the percentage chance of succeeding is $$\(60 \%\)$$ Write program code for the method CalculateScore () to: - take the type of event and difficulty as parameters - calculate the percentage chance of the character completing the event - return the percentage chance of completing the event as an integer number, for example 60 Save your program. Copy and paste the program code into part 1(d) in the evidence document.

Computer Science
IGCSE&ALevel
CAIE
Exam No:9618_w24_qp_42 Year:2024 Question No:1(d)

Answer:









Knowledge points:

19.1 Algorithms
20.1 Programming Paradigms

Solution:

Download APP for more features
1. Tons of answers.
2. Smarter Al tools enhance your learning journey.
IOS
Download
Android
Download
Google Play
Download