dear god help me
This commit is contained in:
parent
8c68eab857
commit
4c99a1e399
4 changed files with 23 additions and 48 deletions
Binary file not shown.
Binary file not shown.
|
@ -41,12 +41,16 @@ public class App {
|
|||
Date temp = co2Data.getDate();
|
||||
int intHour = temp.getHour();
|
||||
int intMinute = temp.getMinute();
|
||||
int intDay = temp.getDay();
|
||||
if (FillTable.isBreak(intHour, intMinute)) {
|
||||
String whatBreak = FillTable.whatBreakIsIt(intHour, intMinute);
|
||||
String whatBreak = FillTable.whatBreakIsIt(intHour, intMinute, intDay);
|
||||
|
||||
switch (whatBreak) {
|
||||
case "short":
|
||||
|
||||
calculateFiveMinuteBreakPoints(co2Data);
|
||||
break;
|
||||
case "long":
|
||||
calculateLongerBreakPoints(co2Data);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -57,11 +61,12 @@ public class App {
|
|||
}
|
||||
|
||||
private static int calculateFiveMinuteBreakPoints(Co2Data data) {
|
||||
|
||||
calculateBonusPoints(data);
|
||||
return 5;
|
||||
}
|
||||
|
||||
private static int calculateLongerBreakPoints(Co2Data data) {
|
||||
calculateBonusPoints(data);
|
||||
return 10;
|
||||
}
|
||||
|
||||
|
@ -152,6 +157,7 @@ public class App {
|
|||
// debbugingValueLists(room38Data);
|
||||
// debbugingValueLists(room39Data);
|
||||
} else {
|
||||
System.out.println("Calculations in process please do not shut off...");
|
||||
fillInTimeTable();
|
||||
initializeTeachers();
|
||||
calculatePoints(room37Data);
|
||||
|
@ -159,19 +165,21 @@ public class App {
|
|||
calculatePoints(room39Data);
|
||||
sortTeachers();
|
||||
printTeachers();
|
||||
while (true) {
|
||||
int userInput = getUserInput(
|
||||
"Do you want to see how the points were calculated? (Yes 1, No 0; anything is an error)");
|
||||
|
||||
int userInput = getUserInput(
|
||||
"Do you want to see how the points were calculated? (Yes 1, No 0; anything is an error)");
|
||||
|
||||
if (userInput == 1) {
|
||||
printExplanation();
|
||||
printShutDown();
|
||||
} else if (userInput == 0) {
|
||||
printShutDown();
|
||||
} else {
|
||||
System.out.println("Invalid input. Please enter 1 for Yes or 0 for No.");
|
||||
if (userInput == 1) {
|
||||
printExplanation();
|
||||
printShutDown();
|
||||
break;
|
||||
} else if (userInput == 0) {
|
||||
printShutDown();
|
||||
break;
|
||||
} else {
|
||||
System.out.println("Invalid input. Please enter 1 for Yes or 0 for No.");
|
||||
}
|
||||
}
|
||||
|
||||
scanner.close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,40 +109,7 @@ public class FillTable {
|
|||
return false; // Time is outside of the school hours (7 AM to 6 PM roughly)
|
||||
}
|
||||
|
||||
static String whatBreakIsIt(int intHour, int intMinute) {
|
||||
// Iterate through the timetable for all rooms and days
|
||||
for (int roomIndex = 0; roomIndex < App.timeTable.length; roomIndex++) {
|
||||
for (int dayIndex = 0; dayIndex < App.timeTable[roomIndex].length; dayIndex++) {
|
||||
for (int lessonIndex = 0; lessonIndex < App.timeTable[roomIndex][dayIndex].length; lessonIndex++) {
|
||||
Lesson lesson = App.timeTable[roomIndex][dayIndex][lessonIndex];
|
||||
if (lesson != null) {
|
||||
// Check if this lesson is labeled as "Lunch"
|
||||
if (lesson.getStartTime().equals("Lunch")
|
||||
|| lesson.getEndTime().equals("Lunch")) {
|
||||
return "Lunch"; // It's lunch time
|
||||
}
|
||||
// Check if the time is between any lessons (a short break)
|
||||
String[] startTime = lesson.getStartTime().split(":");
|
||||
String[] endTime = lesson.getEndTime().split(":");
|
||||
|
||||
int startHour = Integer.parseInt(startTime[0]);
|
||||
int startMinute = Integer.parseInt(startTime[1]);
|
||||
int endHour = Integer.parseInt(endTime[0]);
|
||||
int endMinute = Integer.parseInt(endTime[1]);
|
||||
|
||||
// Check if the given time is during the current lesson
|
||||
if ((intHour > startHour
|
||||
|| (intHour == startHour && intMinute >= startMinute)) &&
|
||||
(intHour < endHour || (intHour == endHour
|
||||
&& intMinute < endMinute))) {
|
||||
return "Short"; // It is a short break (between lessons)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static String whatBreakIsIt(int intHour, int intMinute, int intDay) {
|
||||
return "No Break"; // If no break is found, return "No Break"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue