I am asked in an assignment in java course to sort multiple arrays according to the Average of the student
201302972, AhmadJouni, 82 , 85 , 89 , Average: 85.333336
201303123, Joe, 70 , 75 , 96 , Average: 80.333336
201401034, Mohamad, 90 , 54 , 49 , Average: 64.333336
201402100, Ali, 80 , 90 , 99 , Average: 89.666664
My arrays :
int ID[] = new int [4];
int Grades[][]= new int [4][3];
String Name[] = new String[4];
I have to sort all of the above according to averages in increasing order
Final output should look like
201401034, John, 90 , 54 , 49 , Average: 64.333336
201303123, Joe, 70 , 75 , 96 , Average: 80.333336
201302972, Mike, 82 , 85 , 89 , Average: 85.333336
201402100, Amy, 80 , 90 , 99 , Average: 89.666664
Note : The use of objects/constructors is not allowed , should be done in some simple way. This is the challenge
Full code : http://textuploader.com/1he1
Stringis an object in Java ... I really think these teachers that don't teach idiomatic Java or Object Oriented analysis and design are doing a dis-service to the students if they are going to use Java. If you want to teach the fundamentals, useC, don't use an OO language and just confuse the students even more! The correct way in Java of course is to use aComparatorandCollections.sort()! These raw array based exercises are not what employers are looking for when you get up at a whiteboard during your first interviews!