I'm having a bit of trouble adding the two noted above. I have two classes. Employee and Company.
The employee class holds some information about the employees, instance variables including their name, dates, numOfSales etc etc. And also some methods such as setName, getName and so on.
The Company class creates an empty List. It then has a method which reads the list of employees from a text file - which is then how the list gets filled up.
What I need to do is: sort the list by their numOfSales. I first of all need to modify the employee class so that it implements the Comparable interface.
public class Employee implements Comparable<Company>
I'm not sure if company or employee should go in there ^ <> ? But when I try either, I get the error message that 'Employee is not abstract and does not override abstract method CompareTo in java.lang.Comparable' What am I doing wrong here? I must not changed any of the classes, they must not be changed to abstract or anything and I must not add any new ones.
I then need to write a compareTo() method, I take it in the employee class? that will allow the employees to be sorted in ascending order of the value stored by their numOfSales instance variable.
public class Employee implements Comparable<Employee>, and you should implementpublic int compareTo(Employee other).