Anonymous user
Top rank per group: Difference between revisions
m
→{{header|Elena}}
imported>Arakov |
imported>Arakov |
||
Line 1,674:
class Employee
{
string Name : prop;
string ID : prop;
int Salary : prop;
string Department : prop;
Line 1,684:
.writePaddingRight(ID, 12)
.writePaddingRight(Salary.toPrintable(), 12)
.write
}
Line 1,690:
{
topNPerDepartment(n)
= self.groupBy::(x => x.Department ).selectBy::(x)
{
^ new {
Line 1,696:
Employees
= x.orderBy::(f,l => f.Salary > l.Salary ).top(n).summarize(new ArrayList());
}
};
Line 1,720:
};
employees.topNPerDepartment
{
console.printLine("Department: ",info.Department);
info.Employees.forEach
console.writeLine
};
|