Skip to content

Commit

Permalink
documented dataUtilities.java
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsilva010 committed Apr 16, 2024
1 parent 8580c65 commit 135eda2
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/Utils/dataUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
import javafx.scene.control.Alert.AlertType;

public class DataUtilities {
/**
* Converts a grade string to a double value.
*
* @param grade the grade string to be converted
* @return the converted double value. Returns -1.0 if the grade string does not
* start with "A", "B", "C", "D", or "F".
*/
public static double convertGradeToDouble(String grade) {
if (grade.startsWith("A")) {
return 4.0;
Expand All @@ -26,6 +33,12 @@ public static double convertGradeToDouble(String grade) {
}
}

/**
* Retrieves the course name associated with the given CRN from the database.
*
* @param crn the CRN (Course Reference Number) of the course
* @return the course name if found, null otherwise
*/
public static String getCourseName(String crn) {
String user = System.getenv("USER");
String password = System.getenv("PASSWORD");
Expand All @@ -48,14 +61,4 @@ public static String getCourseName(String crn) {
}
return null;
}

public static String formatDateFromYYMMDDToMMDDYY(String date) {
String [] parts = date.split("-");
return parts[1] + "-" + parts[2] + "-" + parts[0];
}

public static String formatDateFromMMDDYYToYYMMDD(String date) {
String[] parts = date.split("-");
return parts[2] + "-" + parts[0] + "-" + parts[1];
}
}

0 comments on commit 135eda2

Please sign in to comment.