Class CourseUtilities

java.lang.Object
edu.ucsb.cs156.courses.utilities.CourseUtilities

public class CourseUtilities extends Object
static utility methods for dealing with courses
  • Method Details

    • makeFormattedCourseId

      public static String makeFormattedCourseId(String subjectArea, String courseNumber)
      Given a subject area and course number, return a course id that is formatted similarly to the precise way that course numbers are formatted in UCSB's GOLD system.

      That format has the subject area left justified in an 8 character field, followed by the course number right justified in a 3 character field, followed by the suffix (if any) left justified in a 2 character field.

      However, we use this function to query rtora's CSV files with grade data, at https://github.com/rtora/UCSB_Grades/ in which this course id is trimmed, such that there are never ending spaces.

      Therefore, we intentionally also trim the result course id in this function to properly query the CSV files. For example, CMPSC 130A would typically be written:

      "CMPSC 130A "

      but we return "CMPSC 130A" to query the CSV file.

      Parameters:
      subjectArea - subject area, such as CMPSC
      courseNumber - course number, such as 130A
      Returns:
      formatted course number