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(); |             Date temp = co2Data.getDate(); | ||||||
|             int intHour = temp.getHour(); |             int intHour = temp.getHour(); | ||||||
|             int intMinute = temp.getMinute(); |             int intMinute = temp.getMinute(); | ||||||
|  |             int intDay = temp.getDay(); | ||||||
|             if (FillTable.isBreak(intHour, intMinute)) { |             if (FillTable.isBreak(intHour, intMinute)) { | ||||||
|                 String whatBreak = FillTable.whatBreakIsIt(intHour, intMinute); |                 String whatBreak = FillTable.whatBreakIsIt(intHour, intMinute, intDay); | ||||||
| 
 | 
 | ||||||
|                 switch (whatBreak) { |                 switch (whatBreak) { | ||||||
|                     case "short": |                     case "short": | ||||||
| 
 |                         calculateFiveMinuteBreakPoints(co2Data); | ||||||
|  |                         break; | ||||||
|  |                     case "long": | ||||||
|  |                         calculateLongerBreakPoints(co2Data); | ||||||
|                         break; |                         break; | ||||||
| 
 | 
 | ||||||
|                     default: |                     default: | ||||||
|  | @ -57,11 +61,12 @@ public class App { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private static int calculateFiveMinuteBreakPoints(Co2Data data) { |     private static int calculateFiveMinuteBreakPoints(Co2Data data) { | ||||||
| 
 |         calculateBonusPoints(data); | ||||||
|         return 5; |         return 5; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private static int calculateLongerBreakPoints(Co2Data data) { |     private static int calculateLongerBreakPoints(Co2Data data) { | ||||||
|  |         calculateBonusPoints(data); | ||||||
|         return 10; |         return 10; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -152,6 +157,7 @@ public class App { | ||||||
|             // debbugingValueLists(room38Data); |             // debbugingValueLists(room38Data); | ||||||
|             // debbugingValueLists(room39Data); |             // debbugingValueLists(room39Data); | ||||||
|         } else { |         } else { | ||||||
|  |             System.out.println("Calculations in process please do not shut off..."); | ||||||
|             fillInTimeTable(); |             fillInTimeTable(); | ||||||
|             initializeTeachers(); |             initializeTeachers(); | ||||||
|             calculatePoints(room37Data); |             calculatePoints(room37Data); | ||||||
|  | @ -159,19 +165,21 @@ public class App { | ||||||
|             calculatePoints(room39Data); |             calculatePoints(room39Data); | ||||||
|             sortTeachers(); |             sortTeachers(); | ||||||
|             printTeachers(); |             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( |                 if (userInput == 1) { | ||||||
|                     "Do you want to see how the points were calculated? (Yes 1, No 0; anything is an error)"); |                     printExplanation(); | ||||||
| 
 |                     printShutDown(); | ||||||
|             if (userInput == 1) { |                     break; | ||||||
|                 printExplanation(); |                 } else if (userInput == 0) { | ||||||
|                 printShutDown(); |                     printShutDown(); | ||||||
|             } else if (userInput == 0) { |                     break; | ||||||
|                 printShutDown(); |                 } else { | ||||||
|             } else { |                     System.out.println("Invalid input. Please enter 1 for Yes or 0 for No."); | ||||||
|                 System.out.println("Invalid input. Please enter 1 for Yes or 0 for No."); |                 } | ||||||
|             } |             } | ||||||
| 
 |  | ||||||
|             scanner.close(); |             scanner.close(); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -109,40 +109,7 @@ public class FillTable { | ||||||
|         return false; // Time is outside of the school hours (7 AM to 6 PM roughly) |         return false; // Time is outside of the school hours (7 AM to 6 PM roughly) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     static String whatBreakIsIt(int intHour, int intMinute) { |     static String whatBreakIsIt(int intHour, int intMinute, int intDay) { | ||||||
|         // 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) |  | ||||||
|                         } |  | ||||||
|                     } |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         return "No Break"; // If no break is found, return "No Break" |         return "No Break"; // If no break is found, return "No Break" | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Sage The DM
						Sage The DM