Further programming
192 questions. Open a question to solve it and check the official answer.
Programming paradigms · 6 marks · official answer ready
(a) Write program code to declare the attributes and constructor for the Animal class. You only need to write the set and get methods for the attribute Across. You should also wri…
Programming paradigms · 5 marks · official answer ready
(b) The Constructor method of the Desert class: • initialises an empty grid • creates 5 animal objects which are added to the AnimalList (an array of animal objects currently on t…
Programming paradigms · 4 marks · official answer ready
(i) The function GenerateChangeInCoordinate: • receives a coordinate (across or down number) as a parameter • checks whether the coordinate’s value is at a boundary of the grid • …
Programming paradigms · 4 marks · official answer ready
(ii) The Move method uses the GenerateChangeInCoordinate function to calculate the new Across and Down values for an animal. If there is food in the new position in the grid, the …
Programming paradigms · 2 marks · official answer ready
(d) The programmer plans to add a graphic display to the program. The programmer will make use of a program library. Explain what is meant by a program library. ..................…
Programming paradigms · 3 marks · official answer ready
(a) Complete the class diagram. Account AccountNumber : STRING Balance : CURRENCY Constructor() GetAccountNumber() GetBalance() SetAccountNumber() SetBalance() CurrentAccount Savi…
Programming paradigms · 5 marks · official answer ready
(b) Write program code to declare the Account class. Programming language .........................................................................................................…
Programming paradigms · 5 marks · official answer ready
(c) Write program code to declare the SavingsAccount class. Do not write any get or set methods. Programming language .............................................................…
Programming paradigms · 6 marks · official answer ready
(a) Write program code to declare the attributes and constructor for the Animal class. You only need to write the set and get methods for the attribute Across. You should also wri…
Programming paradigms · 5 marks · official answer ready
(b) The Constructor method of the Desert class: • initialises an empty grid • creates 5 animal objects which are added to the AnimalList (an array of animal objects currently on t…
Programming paradigms · 4 marks · official answer ready
(i) The function GenerateChangeInCoordinate: • receives a coordinate (across or down number) as a parameter • checks whether the coordinate’s value is at a boundary of the grid • …
Programming paradigms · 4 marks · official answer ready
(ii) The Move method uses the GenerateChangeInCoordinate function to calculate the new Across and Down values for an animal. If there is food in the new position in the grid, the …
Programming paradigms · 2 marks · official answer ready
(d) The programmer plans to add a graphic display to the program. The programmer will make use of a program library. Explain what is meant by a program library. ..................…
Programming paradigms · 1 mark · official answer ready
(i) State the term used to describe the relationship between these classes. .......................................................................................................…
Programming paradigms · 2 marks · official answer ready
(ii) Draw the appropriate diagram to represent this relationship. Do not list the attributes and methods of the classes. [2] 9
Programming paradigms · 5 marks · official answer ready
(b) The design for the Node class consists of: • attributes Data : STRING Pointer : INTEGER • methods CreateNode(Data, Pointer) SetData(Data) SetPointer(Pointer) GetData() RETURNS…
Programming paradigms · 1 mark · official answer ready
(i) Explain the meaning of the term null pointer. .................................................................................................................................…
Programming paradigms · 2 marks · official answer ready
(ii) Give an appropriate value to represent the null pointer for this design. Justify your answer. ................................................................................…
Programming paradigms · 7 marks · official answer ready
(iii) Write program code for the LinkedList class declaration and the constructor. Programming language used ......................................................................…
Programming paradigms · 1 mark · official answer ready
(iv) Write program code to instantiate a linked list object with the contacts identifier. Programming language used ...............................................................…
