Олимпиадный тренинг

Задача . G


Задача

Темы:
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
}
}

(g) Construct the method addSales(Sales s, String id), in the Main class, that will add a new Sales object s, to the salesperson with a specified ID.
Note: You can assume that the ID is a valid one.

time 500 ms
memory 256 Mb
Правила оформления программ и список ошибок при автоматической проверке задач

Статистика успешных решений по компиляторам
 Кол-во
Java12
Комментарий учителя