From 390b59addfbd0dd056d3e040df5e10ad271dab24 Mon Sep 17 00:00:00 2001 From: Sage The DM Date: Tue, 29 Oct 2024 22:13:53 +0100 Subject: [PATCH] Project --- Code/Steiner/CO2-Daten-Projekt/bin/App.class | Bin 2328 -> 5668 bytes .../CO2-Daten-Projekt/bin/FillTable.class | Bin 459 -> 2699 bytes .../CO2-Daten-Projekt/bin/Lesson.class | Bin 444 -> 985 bytes .../CO2-Daten-Projekt/bin/Teacher.class | Bin 733 -> 1967 bytes Code/Steiner/CO2-Daten-Projekt/src/App.java | 156 ++++++++++++++---- .../CO2-Daten-Projekt/src/FillTable.java | 80 ++++++--- .../Steiner/CO2-Daten-Projekt/src/Lesson.java | 39 ++++- .../CO2-Daten-Projekt/src/Teacher.java | 39 ++++- 8 files changed, 254 insertions(+), 60 deletions(-) diff --git a/Code/Steiner/CO2-Daten-Projekt/bin/App.class b/Code/Steiner/CO2-Daten-Projekt/bin/App.class index e2013f8a04fde645b962937f83415d2aa9accb52..15b3ed9601ee93cb54cba735ffe5b55c05daf89e 100644 GIT binary patch literal 5668 zcmb_g33OD|8UAi&l6e^(Fg!?rfbduX3Cn~82ul(aLV$rGK_);0R(;Gok|C3M!@M^@ z(AKJGH@k0YYn5u7F4ij4Fh#+()-G1N@2jnC_0+C*wY8?-ee;q`5Iy#s=A7L1zyI>x zf4OfSec{YG04<^=fD!@U`b;JOzd-1qaoDI!8R_o2j{OJCxFZm-<3>7dW(6ik-QAp% zOx48-i%kN-ogE$9uW0Sq)!r!}A_C)Et+eeJX=k^Q%9%cj@d=b~T;Ek7k_)8*YP2mD z>u4WcQ^_i8S$)gbY&0B$suW3!CT)kJ%45mywBh8krogoGwwt5!SkpSGk;`UvflXnu zsxT>cl6_{Uu|Guy_7mb>>ZKZi8)Y-PabxYgMDBNmw!owp!B&nrm>0m@F@VSV zZO80WF(1_eCCRivML~h2RToKTat?JcjlQNJW?`X<8q^AuHG49r)m)Iac6T`h7ON;l znS!MPD|;L#W3R2NGcw7r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oqnRYpz}R^E)}vZ#>MSc0g18Tq>2yFYir8N_hb>Cqc!QoCAgmv;t;=q<6r*Jz#RSN*yR@HwN<}7vyyqMdt%nF z%)L+j`129w{#xx_!q8c?Okho|-e+*#1R87gsKJXSu&h>(8GQQ$=GW>22G5?rEdONL zWMI;sbS8b1>t7u^_E@P+IYjv?7O&J}j;HB%96FPcu3uDt(kVsGngBnHc68 z?OnvOi&#^61xWceoZJ}7s^vY`KC~wxlZ{uw>tV=My20l44N3y z=MClgq#m8g@DdsUnrXO&hFfX4g@)U3jt%)S^CyViV18oS{0BFi4@{e91qtVr=&^;6u6)O1f)TtvOt0;{n;FFksp$A_%A9X3O<03LKz1z z5kksIw~yJ`+1-!Nw|4;N7&)*6-la*?sfttWz!nVW>RE-U${)h(c&?L5&^a@?sV0Kf z?%qsbUle!RM+;sLZFB^K$mIHJk;S@P=?H?TNK`sgrKxqlLA!c1Pl9gL3_KN#?m7LY zD6+$&smXq*zv%J5=*b%D-xiB9(G=B!exrR*-+?i>HID^sM%-UeJ0N!EX!V)O^dcBT97q-C0sXAA~r3x3r z&(l*qO9bpVidF*RNT8l*H9OJqv07zK`a*h7vX;B<>58`h!Uo0-F*J%8VXJxTr9CC{fK&SE81o zZHYQ60!=>%_3_zis^hVmE{(@%rj`>G2VCD=+Q~_<7O41HaOB!u=;VuuiB?lk4XVfg zX4UQw?)npu)Hk{ftVZR>znPV(_`tE%M$uV3)1LwsRL^$4=IHT+{FLY=9awCXki|C5 zNhZxn7R^Zp=`0gN;vRh)RDGj{;v<6Mvqh9PSX5ZY*<_beb>Ox558TWKO$DRg5!bCdN)EP@4rqx4U twq(_=Wp-D|l1noN(nuQ1oR$&_Ro4GC<}8#!nfm)iVd_7yy0BDcDSvp35nuoS diff --git a/Code/Steiner/CO2-Daten-Projekt/bin/Teacher.class b/Code/Steiner/CO2-Daten-Projekt/bin/Teacher.class index 15feed7e0b7a943f6963836aca9353b7f278520d..1cb89e26971cda142be98fa0c165fa1f98bb031c 100644 GIT binary patch literal 1967 zcmZuxTUQ%Z7~Lmix-gmrp*Zwe3>Za=DgouH_%_5BLXscDc_aa)S6WGkbrxeZKR3^V{D){tVzOK93?K z5M8j$T)}dqXb@;yGdInFqUq!ZGRtdL&J$>G%#tM_)7q5vT-(VH3q&@`w&PU<#0(QD z$MfcfKx@_4_w3>T2|6}q?Yv`pzROI5JFO$T6Ypk5nZp>#6>Z1%Mg_u&-bE@KFRxfp zvF_TqG+PFl4=!@HT@-IRfQm}BhMFAW@Hr}&Xuw_F4FQpebefdqAo zSfQ4Nm3KGfrr?c3Ah_5IziVdyP}4|z!b@8mPyfd z+Ag~*rbE|rilsG8jnl4KFxksFaw&RVV0g;T=WT}-=1I;{?E`;o*Vd4O9?e(X1okHCXQ`H0MZXhABO+>M-;3jYHK1_@W!wpC)%1&A6gPJ4 zay61w=yajBvfLpqZ4)K^%QPfr)LO-|W#7$NQ?@#8ye6w(Ed_d5I?R7Z7$H@kUm2-a z77~}x0gFF97oD8AF5IBk7ub)l7) zq@4+Z(Gg7h7T&HUAK+Wi)|mVr*T3OM2pF literal 733 zcmZ{g%TB^T6o&tS(ps#bfa3kK15D%rylhNNNC=u}*cY5Y2^Ld|Pvt@rjfo2%z=tya zGmN03Z8CG_-2U&J_m9^%0LR#MkPvXLq~Gq!$bluW*z@oFYTpk#)$>+QwqpS+^lzj< zu09Q2#!(P<4h8JnK@i460a4@QCTR4>+zqJi*3Aq=ayl|@XyQVtJj=m^ z;a7so)C)5JQ8u< z^L4H>fNbRjUS5Z1lA^GCx*<{R8yd|5l&(88;Cstu_qww*kE@x<#&*! j`(GgWKS4IJWs0XD8$UKP1}Rc*^&b$maJ7MLt+?|Ew}oX$ diff --git a/Code/Steiner/CO2-Daten-Projekt/src/App.java b/Code/Steiner/CO2-Daten-Projekt/src/App.java index 29ec19d..34e34a2 100644 --- a/Code/Steiner/CO2-Daten-Projekt/src/App.java +++ b/Code/Steiner/CO2-Daten-Projekt/src/App.java @@ -1,47 +1,141 @@ import java.util.List; +import java.util.Arrays; +import java.util.Scanner; public class App { - // Fetch data for rooms - private List room39Data = Data.getData("https://api.thingspeak.com/channels/1521262/feeds.csv", 39); - private List room38Data = Data.getData("https://api.thingspeak.com/channels/1364580/feeds.csv", 38); - private List room37Data = Data.getData("https://api.thingspeak.com/channels/1521263/feeds.csv", 37); + private static final Scanner scanner = new Scanner(System.in); // Initialize the scanner + + // Constants for rooms and timetable dimensions + private static final int ROOM_COUNT = 3; + private static final int DAY_COUNT = 5; + private static final int LESSON_COUNT = 12; + + // Data sources for different rooms + private static final List room39Data = Data.getData("https://api.thingspeak.com/channels/1521262/feeds.csv", + 39); + private static final List room38Data = Data.getData("https://api.thingspeak.com/channels/1364580/feeds.csv", + 38); + private static final List room37Data = Data.getData("https://api.thingspeak.com/channels/1521263/feeds.csv", + 37); // Time table - // [Room 37 (0), 38 (1), or 39 (2)][Day 0-4][Lesson slot 0-11] - static Lesson[][][] timeTable = new Lesson[3][5][12]; + public static final Lesson[][][] timeTable = new Lesson[ROOM_COUNT][DAY_COUNT][LESSON_COUNT]; - public static void main(String[] args) { - fillInTimeTable(); + // Teacher initials and array + private static final String[] TEACHER_INITIALS = { + "Bä", "Bd", "Bu", "Cg", "Di", "Do", "Eh", "Es", "Fh", "Gi", + "Gr", "Hm", "Hi", "Kg", "Kh", "Lz", "Lu", "Or", "Re", "Se", + "Ts", "Vt", "Zu" + }; + private static final Teacher[] teachers = new Teacher[TEACHER_INITIALS.length]; - // Display filled timetable for verification - for (int room = 0; room < timeTable.length; room++) { - for (int day = 0; day < timeTable[room].length; day++) { - System.out.println("Room " + (room + 37) + ", Day " + (day + 1) + ":"); - for (int lesson = 0; lesson < timeTable[room][day].length; lesson++) { - Lesson lessonData = timeTable[room][day][lesson]; - if (lessonData != null) { - System.out.println(" Lesson " + (lesson + 1) + ": " + lessonData); - } else { - System.out.println(" Lesson " + (lesson + 1) + ": No Lesson"); - } - } - } + // Initialization of teachers + private static void initializeTeachers() { + for (int i = 0; i < teachers.length; i++) { + teachers[i] = new Teacher(TEACHER_INITIALS[i]); } } + // Filling in the timetable private static void fillInTimeTable() { - // Fill Room 37 timetable - FillTable.fillRoom37TimeTable(); - - // Fill Room 38 timetable - FillTable.fillRoom38TimeTable(); - - // Fill Room 39 timetable - FillTable.fillRoom39TimeTable(); - + FillTable.fill37TimeTable(); + FillTable.fill38TimeTable(); + FillTable.fill39TimeTable(); } - private static void fillRoom37TimeTable() { + // Calculate points based on criteria + private static void calculatePoints() { + // TODO: Implement point calculation logic based on specific criteria. + // Example: If a teacher opens the window during a small break (entire break 5 + // points - can + // be reduced by the amount the window was open). + // Maximum points for a long break: 10 points. + // Plus 5 bonus points if the teachers are switching after. + for (Teacher teacher : teachers) { + // Implement logic to calculate points for each teacher + teacher.setPoints(0); // Replace with actual calculation + } + } + // Sort teachers by their points + private static void sortTeachers() { + Arrays.sort(teachers, (t1, t2) -> Integer.compare(t2.getPoints(), t1.getPoints())); + } + + // Print the teachers and their points + private static void printTeachers() { + System.out.println("Teachers and their points:"); + + int rank = 1; // Start with rank 1 + int previousPoints = -1; // Track the points of the previous teacher + int currentRankCount = 0; // Count how many teachers share the same rank + + for (Teacher teacher : teachers) { + if (teacher.getPoints() != previousPoints) { + rank += currentRankCount; // Update rank if points are different + currentRankCount = 1; // Reset count for the new points + } else { + currentRankCount++; // Increment count for same points + } + + // Print the teacher with their rank and points + System.out.printf("%d. %s - %d points%n", rank, teacher.getName(), teacher.getPoints()); + previousPoints = teacher.getPoints(); // Update previous points + } + } + + // Get user input from the console + private static int getUserInput(String textOutput) { + System.out.println(textOutput); + while (!scanner.hasNextInt()) { + System.out.println("Invalid input. Please enter a number."); + scanner.next(); // Clear the invalid input + } + return scanner.nextInt(); // Read user input + } + + // Print explanation of point calculations + private static void printExplanation() { + System.out.println("Point calculation explanation:"); + System.out.println("1. 5 points for keeping the window open during a small break."); + System.out.println("2. Up to 10 points for long breaks, with deductions for window usage."); + System.out.println("3. Bonus points for switching teachers."); + } + + // Print shutdown animation + private static void printShutDown() { + System.out.println("Shutting down..."); + for (int i = 3; i > 0; i--) { + System.out.print(i + "..."); + try { + Thread.sleep(1000); // Sleep for 1 second + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } + System.out.println("Goodbye!"); + } + + public static void main(String[] args) { + fillInTimeTable(); + initializeTeachers(); + calculatePoints(); + sortTeachers(); + printTeachers(); + + 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 { + // Handle invalid input + System.out.println("Invalid input. Please enter 1 for Yes or 0 for No."); + } + + scanner.close(); // Close the scanner to avoid resource leaks } } diff --git a/Code/Steiner/CO2-Daten-Projekt/src/FillTable.java b/Code/Steiner/CO2-Daten-Projekt/src/FillTable.java index d64b605..66b07cb 100644 --- a/Code/Steiner/CO2-Daten-Projekt/src/FillTable.java +++ b/Code/Steiner/CO2-Daten-Projekt/src/FillTable.java @@ -1,28 +1,70 @@ public class FillTable { - // Fill Room 37 timetable - static void fillRoom37TimeTable() { - // Monday - // Tuesday - // Wednesday - // Thursday - // Friday + // Define start and end times as class variables + // #region Class Variables + private static final String[] START_TIMES = { + "7:45", "8:35", "9:40", "10:30", "11:20", "12:10", "12:50", + "13:35", "14:25", "15:15", "16:15", "17:05" + }; + + private static final String[] END_TIMES = { + "8:30", "9:20", "10:25", "11:15", "12:05", "12:50", "13:30", + "14:20", "15:10", "16:10", "17:00", "17:50" + }; + + // #region fillTable + // Example method to fill a timetable with teachers + private static void fillTable(String[] teacherNames, String day, String[] startTime, String[] endTime, + int roomIndex) { + int dayIndex = getDayIndex(day); + for (int i = 0; i < teacherNames.length; i++) { + // Room is determined by the caller method + App.timeTable[roomIndex][dayIndex][i] = new Lesson(37, teacherNames[i], startTime[i], endTime[i], day); + } + } + + private static int getDayIndex(String day) { + switch (day) { + case "Monday": + return 0; + case "Tuesday": + return 1; + case "Wednesday": + return 2; + case "Thursday": + return 3; + case "Friday": + return 4; + default: + return -1; // Invalid day + } + } + + // Fill 37 timetable + // #region table 37 + static void fill37TimeTable() { + int roomIndex = 0; + fillTable(new String[] { "Hm", "Py", "Hi", "Hm", "Le", "", "Gi", "Gi", "D", "Ts", "Ts", "" }, + "Monday", START_TIMES, END_TIMES, roomIndex); } // Fill Room 38 timetable - static void fillRoom38TimeTable() { - // Monday - // Tuesday - // Wednesday - // Thursday - // Friday + // #region table 38 + static void fill38TimeTable() { + int roomIndex = 1; + fillTable(new String[] { "Bz", "Bz", "Bz", "Bz", "Bz", "", "Hn", "Hn", "Bu", "Bu", "Hn", "Hn" }, + "Monday", START_TIMES, END_TIMES, roomIndex); + fillTable(new String[] { "Br", "Kg", "Kh", "Re", "Es", "", "Bt", "EW", "FR", "FR", "VW", "VW" }, + "Tuesday", START_TIMES, END_TIMES, roomIndex); } // Fill Room 39 timetable - static void fillRoom39TimeTable() { - // Monday - // Tuesday - // Wednesday - // Thursday - // Friday + // #region table 39 + static void fill39TimeTable() { + int roomIndex = 2; + fillTable(new String[] { "", "", "", "", "", "", "", "", "", "", "", "" }, + "Monday", START_TIMES, END_TIMES, roomIndex); + fillTable(new String[] { "", "", "", "", "", "", "", "", "", "", "", "" }, + "Tuesday", START_TIMES, END_TIMES, roomIndex); } } + diff --git a/Code/Steiner/CO2-Daten-Projekt/src/Lesson.java b/Code/Steiner/CO2-Daten-Projekt/src/Lesson.java index bc2a0f4..fd93484 100644 --- a/Code/Steiner/CO2-Daten-Projekt/src/Lesson.java +++ b/Code/Steiner/CO2-Daten-Projekt/src/Lesson.java @@ -1,13 +1,36 @@ public class Lesson { - int room; - String teacherName; - String startTime; - String endTime; - String day; + private int room; + private String teacherName; + private String startTime; + private String endTime; + private String day; - public Lesson(int room, String teacherName) { + // Constructor to initialize all fields + public Lesson(int room, String teacherName, String startTime, String endTime, String day) { this.room = room; this.teacherName = teacherName; - + this.startTime = startTime; + this.endTime = endTime; + this.day = day; } -} + + public int getRoom() { + return room; + } + + public String getTeacherName() { + return teacherName; + } + + public String getStartTime() { + return startTime; + } + + public String getEndTime() { + return endTime; + } + + public String getDay() { + return day; + } +} \ No newline at end of file diff --git a/Code/Steiner/CO2-Daten-Projekt/src/Teacher.java b/Code/Steiner/CO2-Daten-Projekt/src/Teacher.java index d8323ec..1331336 100644 --- a/Code/Steiner/CO2-Daten-Projekt/src/Teacher.java +++ b/Code/Steiner/CO2-Daten-Projekt/src/Teacher.java @@ -1,9 +1,44 @@ +import java.util.HashMap; +import java.util.Map; + public class Teacher { private String name; private int points; + // Mapping of initials to full names + private static final Map nameMap = new HashMap<>(); + + // Static block to initialize the name mappings + static { + nameMap.put("Hm", "Hummel"); + nameMap.put("Bä", "Bäcker"); + nameMap.put("Bd", "Bender"); + nameMap.put("Bu", "Burger"); + nameMap.put("Cg", "Chung"); + nameMap.put("Di", "Dimitrov"); + nameMap.put("Do", "Doe"); + nameMap.put("Eh", "Ehrlich"); + nameMap.put("Es", "Esposito"); + nameMap.put("Fh", "Fischer"); + nameMap.put("Gi", "Giordano"); + nameMap.put("Gr", "Graham"); + nameMap.put("Hi", "Higgins"); + nameMap.put("Kg", "Kang"); + nameMap.put("Kh", "Khan"); + nameMap.put("Lz", "Lozano"); + nameMap.put("Lu", "Lund"); + nameMap.put("Or", "Ortega"); + nameMap.put("Re", "Reyes"); + nameMap.put("Se", "Seng"); + nameMap.put("Ts", "Tanaka"); + nameMap.put("Vt", "Vetter"); + nameMap.put("Zu", "Zuniga"); + // Add more mappings as needed + } + + // Constructor public Teacher(String name) { - this.name = name; + setName(name); points = 0; } @@ -12,7 +47,7 @@ public class Teacher { } public void setName(String name) { - this.name = name; + this.name = nameMap.getOrDefault(name, name); // Set the name based on the mapping } public int getPoints() {