Further programming
152 questions. Open a question to solve it and check the official answer.
Programming paradigms · 3 marks · official answer ready
(ii) The get methods GetName(), GetDifficulty() and GetEventType() each return the relevant attribute. Write program code for the three get methods. Save your program. Copy and pa…
Programming paradigms · 1 mark · official answer ready
(i) Write program code to declare Group local to the main program. Save your program. Copy and paste the program code into part 1(b)(i) in the evidence document. [1]
Programming paradigms · 3 marks · official answer ready
(ii) One group has the following events: Event name Event type Event difficulty Bridge jump 3 Water wade swim 4 100 mile run run 5 Gridlock drive 2 Wall on wall jump 4 Write progr…
Programming paradigms · 4 marks · official answer ready
(c) The class Character stores data about the characters in the game. Each character has a skill level for each type of event. The skill level is an integer between 1 and 5 inclus…
Programming paradigms · 4 marks · official answer ready
(d) 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 t…
Programming paradigms · 0 marks
1 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, s…
Programming paradigms · 2 marks · official answer ready
(i) Amend the main program to declare and create an instance of a Character object for Tarz and for Geni. Save your program. Copy and paste the program code into part 1(e)(i) in t…
Programming paradigms · 7 marks · official answer ready
(ii) Both characters Tarz and Geni take part in each event in the group you created in part 1(b). These steps are repeated for all five events: • The percentage chance of each cha…
Programming paradigms · 1 mark · official answer ready
(iii) Test your program. Take a screenshot of the output. Save your program. Copy and paste the screenshot into part 1(e)(iii) in the evidence document. [1] 8
File processing and exception handling · 5 marks · official answer ready
(b) The function ReadData() reads the data from HighScoreTable.txt and stores the data in a 2D array. The function returns the 2D array. The function uses exception handling when …
File processing and exception handling · 6 marks · official answer ready
(a) The text file Data.txt stores string data items. Each data item is on a new line in the text file. The function ReadData(): • has a local array of strings that can store 45 it…
Programming paradigms · 4 marks · official answer ready
(i) Write program code to declare the class Horse and its constructor. Do not declare the other methods. Use your programming language’s appropriate constructor. All attributes mu…
Programming paradigms · 3 marks · official answer ready
(ii) The get methods GetName() and GetMaxFenceHeight() each return the relevant attribute. Write program code for the get methods. Save your program. Copy and paste the program co…
Programming paradigms · 5 marks · official answer ready
(i) The program has two horses: • The horse named ‘Beauty’ can jump a maximum height of 150 cm and has a success percentage rate of 72%. • The horse named ‘Jet’ can jump a maximum…
Programming paradigms · 1 mark · official answer ready
(ii) Test your program. Take a screenshot of the output. Save your program. Copy and paste the screenshot into part 2(b)(ii) in the evidence document. [1] 8
Programming paradigms · 4 marks · official answer ready
(i) Write program code to declare the class Fence, its constructor and get methods. Use your programming language’s appropriate constructor. All attributes must be private. If you…
Programming paradigms · 5 marks · official answer ready
(ii) The array Course stores four Fence objects. The user inputs the height and risk for each fence, and these are validated before each fence is created. Amend the main program t…
Programming paradigms · 5 marks · official answer ready
(d) The chance of a horse jumping a fence without knocking it down is calculated as follows. If the height of the fence is more than the maximum height a horse can jump, the succe…
Programming paradigms · 3 marks · official answer ready
(i) Write program code to amend the main program to: • calculate and output the chance of the first horse jumping each of the four fences without knocking each fence down • calcul…
Programming paradigms · 2 marks · official answer ready
(ii) Write program code to amend the main program to: • calculate and output the average chance of success for each horse jumping over all four fences without knocking each fence …
