import java.util.*;
public class KJPMPRO {
public static void main(String[] args) {
final List<CollegeDepartment> departments = new ArrayList<>();
Scanner scan = new Scanner(System.in);
for (int q = 1; q <= 6; q++) {
System.out.println("Enter College Department name");
String departmentName = scan.next();
System.out.println("Choreography plss input 1% to 40% only");
int choreography = scan.nextInt();
System.out.println("Execution plss input 1% to 30% only");
int execution = scan.nextInt();
System.out.println("Concept representation plss input 1% to 20% only");
int concept = scan.nextInt();
System.out.println("Appropriateness of props plss input 1% to 10% only");
int appropriateness = scan.nextInt();
departments.add(new CollegeDepartment(departmentName, choreography, execution, concept, appropriateness));
}
departments.sort(new Comparator<CollegeDepartment>() {
@Override
public int compare(final CollegeDepartment left, final CollegeDepartment right) {
return right.getScore() - left.getScore();
}
});
int nth = 0;
for (final CollegeDepartment collegeDepartment : departments) {
++nth;
String postfix = "th";
if (nth == 1) {
postfix = "st";
} else if (nth == 2) {
postfix = "nd";
} else if (nth == 3) {
postfix = "rd";
}
System.out.println(nth + postfix + " is '" + collegeDepartment.getDepartmentName() + "' with " + collegeDepartment.getScore());
}
}
private static class CollegeDepartment {
String _departmentName;
int _choreography;
int _execution;
int _concept;
int _appropriateness;
public CollegeDepartment(String departmentName, int choreography, int execution, int concept, int appropriateness) {
_departmentName = departmentName;
_choreography = choreography;
_execution = execution;
_concept = concept;
_appropriateness = appropriateness;
}
public int getScore() {
return _choreography + _execution + _concept + _appropriateness;
}
public String getDepartmentName() {
return _departmentName;
}
public int getChoreography() {
return _choreography;
}
public int getExecution() {
return _execution;
}
public int getConcept() {
return _concept;
}
public int getAppropriateness() {
return _appropriateness;
}
}
}
Comments
0 B
|👍
/👎