Advertisement
Aldin-SXR

comparable main()

Mar 19th, 2020
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. public static void main(String[] args) {
  2.     Student[] students = {
  3.         new Student("Joshua Valenzia", "IT", 5.9),
  4.         new Student("Emily Davis", "EEE", 8.9),
  5.         new Student("Marco May", "IT", 9.2),
  6.         new Student("Megan Jones", "ARC", 8.7),
  7.         new Student("Donald Lane", "IT", 9.1),
  8.         new Student("Jessica Wilson", "IT", 7.8),
  9.         new Student("Luke Ortiz", "EEE", 5.6),
  10.         new Student("Sarah Johnson", "IT", 10),
  11.         new Student("Yasin Nielsen", "ARC", 8.3),
  12.         new Student("Rebecca Miller", "EEE", 6.9)
  13.     };
  14.        
  15.     /* Sort the students according to GPA */
  16.     BubbleSort.sort(students);
  17.        
  18.     /* Print out the sorted students */
  19.     for (Student s: students) {
  20.         System.out.println(s.fullName + "\t|\t" + s.department + "\t|\t" + s.gpa);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement