Objectives:
• Use an object with a list
• Use a list of objects
Write a class that encapsulates data for a sales person. Class SalesPerson has an ID number (int), a name (string), and a list of sales (float). It provides a constructor init that initializes ID and name, and initializes the list of sales to an empty list. Member methods for SalesPerson include:
• getter methods for ID and name. (Setters for these are not necessary.)
• enterSale(aSale) enters the parameter value into the list of sales.
• totalSales() returns Salesperson's sum total sales.
• getSales () returns a list of all sales – it must return a copy of the list, not an alias.
• metQuota(quota), a boolean method that returns True if the total sales meet or exceed the quota provided, and False if not.
• compareTo (otherPerson) that compares this Salesperson (self) to another (provided as a parameter) based on the values of their total sales amounts.
• a str() method that displays the ID, name, and total sales.
Test SalesPerson thoroughly before continuing.
Write a class to keep track of the sales made by different sales persons. Class SalesForce maintains a list of SalesPerson objects. The constructor has no parameters and should initialize the list. Member methods for SalesForce include:
• addData(fileName) accepts a file name as its only parameter. It inputs information for all salespersons from that file. Each line of the file with contain data in the form:
ID name Sales amounts.
Note that each line contains the id, name and sales amounts for one Salesperson. Each Salesperson may have 0 or more sales.
• quotaReport (quota) prints each salesperson's ID, name and total sales and whether or not the salesperson met the sales quota.
• topSalesPerson () prints the name and total sales amount of the salesperson with the highest sales amount. instead? returns the Salesperson object representing the individual with the highest sales amount.
• individualSales (id) prints the sales record (all of his sales) and the total of his sales for the employee with the ID specified. If there is no employee with the given ID, the method prints an appropriate message.
We have provided SalesTestDriver, which contains a main method that inputs the name of the file from which the sales information is to be read, instantiates an object of type SalesForce, invokes the SaleForce getData() method with the file name, invokes the SaleForce quotaReport() method with a quota amount, invokes the SaleForce topSalesPerson() method and invokes the SalesForce individualSales() method a couple of times. Test data are provided in the file salesdata.txt.
Dont really have a clue how to write
Any help would be greatly appriciative