Computer Science · May / June 2016 · Paper 2 SL · Question 11
Adapt for 2027B3.2.1 inheritance (HL) to build a subclass, B3.1.4 methods over arrays. Its main topic (B3.2) is Higher Level only in 2027; Standard Level students can do only the part on B3.1, B2.2.
IBCS
As printed in the paper
The question as text
11. The hotel accepts group bookings where many clients, such as tour groups, can be allocated rooms on arrival. The Group class contains the name of the group, the number of rooms used by the group and a method bill() that calculates the total bill for the group. Part of the Group class is shown below. public class Group { private String name; // name of group private int number; // number of rooms allocated to the group public Group(String name, int number) { this.name = name; this.number = number; } public String getName() {return name;} public int getNumber() {return number;} int[] gRooms = new int[number]; // array to hold room numbers allocated to the group public double bill(int[] gRooms) {... // method that calculates the bill for the group } } The GClient class represents a client who is part of a group. It inherits all the class members of the Client class and also stores the name of the group.
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
11(a)[7]
11(b)[6]
11(c)[5]
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

