Computer Science · May / June 2017 · Paper 2 SL · Question 11
IBCS
As printed in the paper
The question as text
11. The company employs several sales personnel to sell its products to different retailers. Each branch of the company keeps track of its own sales with a suite of programs that include the two classes SalesPerson and Sales. class SalesPerson // each object contains details of one salesperson { private String id; private Sales[] salesHistory; // details of the different sales private int count = 0; // number of sales made //constructor for a new salesperson public SalesPerson(String id) { // code missing } // constructor for a salesperson transferred (together with // their sales details) from another branch public SalesPerson(String id, Sales[] s, int c) { // code missing } public int getCount(){return count;} public String getId() {return id;} public void setSalesHistory(Sales s) { salesHistory[count] = s; count = count + 1; } public double calcTotalSales() // calculates total sales for the // salesperson { // code missing } public Sales largestSale() // calculates the sale with the largest // value { // code missing } } Each instance variable is initialized when a SalesPerson object is instantiated.
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
11(a)[2]
11(b)[3]
11(c)(i)[4]
11(c)(ii)[2]
11(d)[4]
11(e)[5]
11(f)[5]
11(g)[4]
11(h)[3]
11(i)[3]
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

