Computer Science · May / June 2024 · Paper 2 HL · Question 18
IBCS
As printed in the paper
The question as text
18. The car rental company stores details of its customers as objects of a Customer class, as follows. public class Customer { private String customerID; private String name; // more personal data private CarList history; private String level; // constructors // all getter and setter methods public void updateHistory(Car newCar) { // missing code } } Where the class CarList is declared as: public class CarList { private CarNode root; // default constructor public void addToFront(Car newCar) { // missing code } public boolean isEmpty() { return (root null); } public int count() // returns the number of Cars in history { // missing code } … more methods … } (Option D continues on the following page) (Option D, question 18 continued) The class CarNode is declared as: public class CarNode { private Car aCar; private CarNode next; public CarNode (Car newCar) { this.aCar newCar; this.next null; } // getter and setter methods }
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
18(a)[3]
18(b)[4]
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

