Class 11:
public static String firstToken(String s) { while (s.indexOf(' ') == 0) s = s.substring(1); int ind = s.indexOf(' '); if (ind == -1) return ""; return s.substring(0,ind); }
public int compareTo(Object other) { StudentInfo otherStudent = (StudentInfo)other; double gpa1 = computeGPA(); double gpa2 = otherStudent.computeGPA(); if (gpa1 > gp12) return 1; if (gpa1 < gpa2) return -1; return myName.compareTo(otherStudent.myName); }
public void printLargestRadius(Circle[] circles) { if (circles.length == 0) return; double largestRadius = circles[i].getRadius(); for (int i=1; i<circles.length;i++) if (largestRadius < cirlces[i].getRadius(); largestRadius = circles[i].getRadius(); System.out.println(largestRadius); }