A computer program is designed to simulate horses doing show jumping. In show jumping, horses jump over obstacles called fences. A horse successfully jumps a fence if it does not knock the fence down. The program is written using Object-Oriented Programming (OOP). The class Horse stores data about the horses. The class Fence stores data about the fences. Each fence has a height in cm and a risk number. The risk is a whole number between 1 and 5 inclusive. A risk of 1 means the fence is the easiest type to jump. A risk of 5 means the fence is the hardest type to jump. (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 are writing in Python, include attribute declarations using comments. Save your program. Copy and paste the program code into part 2(c)(i) in the evidence document. (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 to: - declare the local array Course - take as input the data for four fences from the user - loop the input until both the height and risk are valid for each fence - create an instance of Fence for each of the four valid fences and store each instance in the array. Save your program. Copy and paste the program code into part 2(c)(ii) in the evidence document.
Exam No:9618_w24_qp_43 Year:2024 Question No:2(c)
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
Download
Android
Download
Download
Google Play
Download
Download