finalize tommorow

This commit is contained in:
Sage The DM 2024-11-25 22:44:57 +01:00
parent 58a45463d4
commit eef49943d5
4 changed files with 22 additions and 14 deletions

View file

@ -54,7 +54,7 @@ public class App {
return averageCO2 / co2DataList.size(); // Example CO2 average level
}
private static void calculateBreakPoints(double[] minuteData, Break calcBreak) {
private static void calculateBreakPoints(double[] minuteData, Break calcBreak, Teacher teacher) {
int duration = calcBreak.getEnd().getMinute() - calcBreak.getStart().getMinute();
int breakPoints = minuteData.length;
if (duration == minuteData.length) {
@ -63,9 +63,17 @@ public class App {
breakPoints--;
}
}
} else
System.out.println("Unexpected error");
if (duration > 5) {
teacher.addPoints(0, breakPoints, 0);
} else {
teacher.addPoints(breakPoints, 0, 0);
}
// check if next lesson is lunch another teacher or the same and plan
// accordingly
}
private static void initializeTeachers() {
@ -161,6 +169,12 @@ public class App {
initializeTeachers();
sortTeachers();
printTeachers();
for (int classrooms = 0; classrooms < 3; classrooms++) {
for (int weekday = 0; weekday < 5; weekday++) {
// get the url and data
// calculate points
}
}
// Loop threw each day with a specific classroom and after the weekdays are over
// go to the next of the 3 classroms
// go threw every break calculate the point and give them to the teacher

View file

@ -42,18 +42,6 @@ public class Teacher {
this.points = new Points(); // Initialize Points object when Teacher is created
}
// #region Timetable Methods
public void setTimetable(String day, String[] classes) {
if (day == null || classes == null || classes.length == 0) {
throw new IllegalArgumentException("Day and classes cannot be null or empty.");
}
timetable.put(day, classes);
}
public String[] getTimetableForDay(String day) {
return timetable.getOrDefault(day, new String[0]);
}
// #region Getters and Setters
public String getName() {
return name; // Return the teacher's full name
@ -73,6 +61,12 @@ public class Teacher {
this.points.setBonusPoints(bonusPoints);
}
public void addPoints(int fiveMinute, int tenMinutes, int bonusPoints) {
this.points.addFiveMinuteBreakPoints(fiveMinute);
this.points.addLongerBreakPoints(tenMinutes);
this.points.addBonusPoints(bonusPoints);
}
public int getTotalPoints() {
return this.points.getTotalPoints();
}