Search Results

Search found 1 results on 1 pages for 'user1502381'.

Page 1/1 | 1 

  • Nesting arbitrary objects in Java

    - by user1502381
    I am having trouble solving a particular problem in Java (which I did not find by search). I do not know how to create a nested lists of objects - with a different type of object/primitive type at the end. For example: *Note: only an example. I am actually doing this below with something other than Employee, but it serves as simple example. I have an array of an object Employee. It contains information on the Employee. public class Employee { int age int salary int yearsWorking public Employee () { // constructor... } // Accessors } What I need to do is organize the Employees by quantiles/percentiles. I have done so by the following: import org.apache.commons.math.stat.descriptive.rank.Percentile; public class EmployeeSort { public void main(String args[]) { Percentile p = new Percentile(); Employee[] employeeArray = new Employee(100); // filled employeeArray double[] ageArray new double[100]; // filled ageArray with ages from employeeArray int q = 25; // Percentile cutoff for (int i = 1; i*q < 100; i++) { // assign percentile cutoff to some array to contain the values } } } Now, the problem I have is that I need to organize the Employees first by the percentiles of age, then percentiles of yearsWorking, and finally by percentiles of salary. My Java knowledge is inadequate right now to solve this problem, but the project I was handed was in Java. I am primarily a python guy, so this problem would have been a lot easier in that language. No such luck.

    Read the article

1