From 8c68eab85719eb9374c4df6a2177574b8c259f86 Mon Sep 17 00:00:00 2001 From: Sage The DM Date: Thu, 14 Nov 2024 14:49:57 +0100 Subject: [PATCH] Help me idk what im doing anymore --- .../CO2-Daten-Projekt-V2/bin/App.class | Bin 6030 -> 6973 bytes .../CO2-Daten-Projekt-V2/bin/Co2Data.class | Bin 4503 -> 4432 bytes .../CO2-Daten-Projekt-V2/bin/FillTable.class | Bin 3915 -> 5157 bytes .../CO2-Daten-Projekt-V2/bin/Lesson.class | Bin 1036 -> 1013 bytes .../CO2-Daten-Projekt-V2/bin/Points.class | Bin 969 -> 969 bytes .../CO2-Daten-Projekt-V2/bin/Teacher.class | Bin 1710 -> 1710 bytes .../Steiner/CO2-Daten-Projekt-V2/src/App.java | 69 +++++++++++++----- .../CO2-Daten-Projekt-V2/src/Co2Data.java | 50 ++++++------- .../CO2-Daten-Projekt-V2/src/FillTable.java | 62 ++++++++++++++++ .../CO2-Daten-Projekt-V2/src/Lesson.java | 22 +++--- .../CO2-Daten-Projekt-V2/src/Points.java | 4 - .../CO2-Daten-Projekt-V2/src/Teacher.java | 10 +-- 12 files changed, 148 insertions(+), 69 deletions(-) diff --git a/Code/Steiner/CO2-Daten-Projekt-V2/bin/App.class b/Code/Steiner/CO2-Daten-Projekt-V2/bin/App.class index 32281a0b32bfa63aa17ed5c27e14cf5d734f707f..d0a7ed6b1dd7b105c44da3bc7ed0eb4f502663a0 100644 GIT binary patch literal 6973 zcmb_gd3+S-d44|aO0!x9kOjy{TniQ;fsll_1QK8nC>AUdMgqbS2-_)T#Qs-^{K?GEV(R z_0ws8a#nt_Xqr$-xl?HK4Gt&&j)hGS8SyUX zc5L0zwY6(!SI0%$PP^?X_wxRt?Ur($ySKZuv$LYATU5o+_sm! zRAuuD%Y0k1PRBsLQ1X~V+ZykQV*@%&bYiPQO>dxcdCMKwww|hm!Zs7ts4-9{ot-8Y zORF1u4D2SL1NfNeK`*;`Yur9&6%-bSBEf;41=xps4eTeRXC2~%i32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lb z9d%u^%(tB#%GhWC$R;hcLgrFKqT zAelU`t#%#v)K2XAklHgN*uJk^%puc9?;9U2#o=TH{*|<%l{&1V7Hg>GTH>pXx7~I8 z(@X~=u^y{&5|OomsOrRKe(%63d=;<30OHD`4xTK-E__(UEPy0F!Vwdd*X2=;%J~0W ze3akiS~pjyNI10+P#%oat5)tjd18zR=B`# zU=S^yk$4NBEL27Dycu}n&!BkunJ?uWRB~>Ke%||i)cbvmza<#BU_YCN?x5Inn4~+Q z(|yJCjL7ST$9|OTrGPb({g=q5qHPolIH^5|CuAtUHXYw6;9H}JbQSRZG5mNR#%u2$ ze@5>AnG!3Q7V{Xnr#-7B*g@}yaUSc3!PNxUlQd4%S&>u2V;EoFX z62GEq(ia*6hcH$2h46Gm8F}(P$K7tB{Ix0%k8>{5tfRbrKejxC=LC92QOlC2Dnmy% zm0UK4-%`zeLXfP=!gEsf-;>7Q*<<*lbX-7Hi3LiF47pl#T9!6l!1T5FcrxEO3`nt;^`v%c=eqbn8Br#;aHwucYZ$ zv*cgHVtFltb{*68dZy|Pbi<8I%A3)JTYc{67E{GBRK5&bM3tzfNsIUg)MM$=GG%-f zf`?Eg4)Kq#mEl(qtd7W=if8#|ZjvyJp5T@rCYr251u^}8#ZuOAw=OnK;70oMCFZsK xM8zzQ*qlWzXJulxsN?TkCin5AEfV#jL9i2vCf|39IFWngrD>&DCDvfp{{ZU!vl{>a diff --git a/Code/Steiner/CO2-Daten-Projekt-V2/bin/Co2Data.class b/Code/Steiner/CO2-Daten-Projekt-V2/bin/Co2Data.class index ef343c870b7e493fe611032b91b335eecbc80c0b..2fbf11af4036dea7277f4d3493b56279942e6ee7 100644 GIT binary patch delta 1469 zcmah|`%_e97=Au>_nfn542QmRu5O#wYY;p<9BrCb56d@C~;D#71v@8yG8El+M z%d+yTR5U}>B+|e%u0qN<+B%D`&W$n6flR)zZvxKS%lJJKCGD&!T%JW+8X z&ABf|X^aS@mdneIWci2EU9-=?tGHG`Z4O22LcxfRg?Pb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UyZ30TqR~>8tQQq)i#Z1tFa!_k;DuR_g37G+pvSDp2h9h z$NQt0iIb?s8Pwrz+>Ja&-U`bt0uSR6?yj{n&19SzF5pq@;#_SU$79equwo*Q;|Wr$ zz;--|r`V45xC>81(w}6CXP8W9;t6<;0Sz4HHEiv`7<921KhuvuH+D11^Gs;{pX&wY z+C!wc2I}7|M$^$LbhPW3q@zq{akzmZ9Su5Plr7oS)AyETu=gNT-|8ZmT}eFl<%z48N@nyG&afb_E78sX6Qq8(}?ch68<=60ypM z4+jS!nr$l_?8Euqd8d(}# z$^{Iup(FXk>-44-CTYhT1bs}k8gJ54nXnOW(bAaq9xBuzwOY)=JG2Z^m_cr^ zZs}R%WN?XF?f^aldI`G3!PxGBZCKIJ}!HGNJ0H{SZ4w_f$u RA90O-6Z}YB$1nH|_CFY2Ob!45 diff --git a/Code/Steiner/CO2-Daten-Projekt-V2/bin/FillTable.class b/Code/Steiner/CO2-Daten-Projekt-V2/bin/FillTable.class index c0468c952cc1bbdf136917de8d8679b32de579b6..d226863c442d91c04883609a56755ab59215cc31 100644 GIT binary patch delta 1275 zcmZuvTW=I)7=FGv@9ZGm#u0aWh+Zhgh$VYLV4DIqF=1)JkP_EmJq&i(F0|9SJ4LL) zQCpAk#&Dr{mJm2$v^S;mbKJSJ0 z7d!0pf4{y6pc{XlwqMb2G%K~9s_z{X&^wC7b$czmEg%Xu(m3zn0+tx4jSW{qfwf0H z<;v)ez60JNuXET7%ANgTwGx!OY`ly2O}ruVCA0}cVAcIYUMSTUYeig<#vT3KVUzH&^PRcEO|#a6BbT*38rIM|B}2GEK-(Sf_M0ry}N zJlu?Z*a4rB{RmLT7|%V312}>aY~z;$$$ju4zm@hOqXg4g3SA`1tZavh9iWW);Tln}zi=ll@}AhW_!s)Wi# zDzWedzD#IzbASy}o4NB;h z=9?7KBh9xcXR|avMNu21`8K7kmFB0V`8`N4Ll?`?_>bQ=m?$YL*a;^d0Zv2dKLerg VSo{DSiPaY!-az1Y-a^42{{YxgCAI(n delta 40 vcmZ3gaaxY+)W2Q(7#J9A8IEt{+R8dvmff6@eRC+gHzy|}!%?6F6T>k890dz% diff --git a/Code/Steiner/CO2-Daten-Projekt-V2/bin/Lesson.class b/Code/Steiner/CO2-Daten-Projekt-V2/bin/Lesson.class index 5f5050b18e9508d40556dd2603b2e575e322ecde..51ac342989c807a4a4e34719f634e8d23c622dc0 100644 GIT binary patch delta 213 zcmeC-_{z?8>ff$?3=9mm44Mff$?3=9mm3|bSpRJa9-^7C{3N^_G^izXU-vT~QFre;s9eXPNS5NBlI zO;0UB<}+((dNMKy0YytDS2MaZmQOy+ILnZmfrWvGfs=ukfe#3U8Tc6_83Y*Q83Y+* zf%e%kumMR0205Sz2q-WpOzvaSXI5lTntXssg;8{JJhLdXGK0$Gzd)WOkSETlGTDk* hg;5qPqXv{I2l5obJar&%3y`M@;<0N0&0}KF1ON^uFlzt+ diff --git a/Code/Steiner/CO2-Daten-Projekt-V2/bin/Points.class b/Code/Steiner/CO2-Daten-Projekt-V2/bin/Points.class index c8ed07b989e67d0332ab887062244840a0ea60e5..7bdc7b645e1e76c29d2b1297432f0c8b21ac9598 100644 GIT binary patch delta 79 zcmX@fev*B|DMm)d$rG7GCqH0RXXF60WSKNrc^Ft3cqe-?xiJa=#cWwcfPB%(mw|i< Yuo``44OSVTnC#>j<^V>;$!nQq02O`__5c6? delta 79 zcmX@fev*B|DMm)7$rG7GCqH0RXXFC2WSKNr`50Ik_$PZYxiJa>#cWx{fPC@Emw|jK Yuo``44OTgznEd1z<^V>O$!nQq02odZ3;+NC diff --git a/Code/Steiner/CO2-Daten-Projekt-V2/bin/Teacher.class b/Code/Steiner/CO2-Daten-Projekt-V2/bin/Teacher.class index 4e1ffccab2b9cba60d6cedf7e8c677b4987b742e..7db2754722218fe6a88a5599cf809dfa0b8d435e 100644 GIT binary patch delta 143 zcmWNJI}QO+7)H-8xsyoD^&Zc`hy;aV`iWAb5|L;XT7?bJQ0Z=E1Imf80UNLZ8?XTj z@Hgjc&UaEj_3sHKDJABVSyN$4l|2CmH7?Y-(%?puCoNvIc@y%X!AQznW{3J45ixewo5{qjyd;d-0Xalzw0hJPPRb1DKXPsrzW@LL delta 143 zcmWNJI}QO+7)H-8xsyoT>-{#EM3_QBFG`I{M50w_6*fRarMs04C?~=OY`_L=zy>V9 z-<+>G-$`s@?;EqQRB`mkGA75AJaY=HDYB)+o-zk2T-3T!<3^n)4PG>P)8a$Omo`5- nB6P(O`G;Ai`}!FW5qlTRWawAHBpk5=GKkV>^{6YHlqt@CY1|d1 diff --git a/Code/Steiner/CO2-Daten-Projekt-V2/src/App.java b/Code/Steiner/CO2-Daten-Projekt-V2/src/App.java index c663df2..f79b847 100644 --- a/Code/Steiner/CO2-Daten-Projekt-V2/src/App.java +++ b/Code/Steiner/CO2-Daten-Projekt-V2/src/App.java @@ -3,9 +3,8 @@ import java.util.List; import java.util.Scanner; public class App { - // #region Fields + // #region Constants private static final Scanner scanner = new Scanner(System.in); - private static final int ROOM_COUNT = 3; private static final int DAY_COUNT = 5; private static final int LESSON_COUNT = 12; @@ -13,16 +12,14 @@ public class App { public static final Lesson[][][] timeTable = new Lesson[ROOM_COUNT][DAY_COUNT][LESSON_COUNT]; private static final Teacher[] teachers = new Teacher[Teacher.nameMap.size()]; - // Get data from the last 8'000 entries seeing as that is the maximum - private static final List room39Data = Co2Data.getData( - "https://api.thingspeak.com/channels/1521262/feeds.csv?results=8000", - 39); - private static final List room38Data = Co2Data.getData( - "https://api.thingspeak.com/channels/1364580/feeds.csv?results=8000", - 38); - private static final List room37Data = Co2Data.getData( - "https://api.thingspeak.com/channels/1521263/feeds.csv?results=8000", - 37); + // URLs for fetching CO2 data + private static final String ROOM_39_URL = "https://api.thingspeak.com/channels/1521262/feeds.csv?results=8000"; + private static final String ROOM_38_URL = "https://api.thingspeak.com/channels/1364580/feeds.csv?results=8000"; + private static final String ROOM_37_URL = "https://api.thingspeak.com/channels/1521263/feeds.csv?results=8000"; + + private static final List room39Data = Co2Data.getData(ROOM_39_URL, 39); + private static final List room38Data = Co2Data.getData(ROOM_38_URL, 38); + private static final List room37Data = Co2Data.getData(ROOM_37_URL, 37); // #region Initialization private static void initializeTeachers() { @@ -38,17 +35,46 @@ public class App { FillTable.fill39TimeTable(); } - // #region Calculations - private static void calculatePoints() { - // Point calculation logic + // #region Calculation + private static void calculatePoints(List data) { + for (Co2Data co2Data : data) { + Date temp = co2Data.getDate(); + int intHour = temp.getHour(); + int intMinute = temp.getMinute(); + if (FillTable.isBreak(intHour, intMinute)) { + String whatBreak = FillTable.whatBreakIsIt(intHour, intMinute); + + switch (whatBreak) { + case "short": + + break; + + default: + break; + } + } + } } + private static int calculateFiveMinuteBreakPoints(Co2Data data) { + + return 5; + } + + private static int calculateLongerBreakPoints(Co2Data data) { + return 10; + } + + private static int calculateBonusPoints(Co2Data data) { + return 5; + } + + // #region Sorting Printing private static void sortTeachers() { Arrays.sort(teachers, (a, b) -> Integer.compare(b.getPoints().getTotalPoints(), a.getPoints().getTotalPoints())); } - // #region Input - Output handler private static void printTeachers() { int rank = 1; int previousPoints = -1; @@ -72,6 +98,7 @@ public class App { } } + // #region User Interaction private static int getUserInput(String textOutput) { System.out.println(textOutput); while (true) { @@ -86,8 +113,8 @@ public class App { private static void printExplanation() { System.out.println("Point calculation explanation:"); - System.out.println("1. Up to 5 points for keeping the window open during a small break."); - System.out.println("2. Up to 10 points for long breaks, depending on window usage."); + System.out.println("1. Up to 5 points for keeping the window open during a small pause."); + System.out.println("2. Up to 10 points for long pauses, depending on window usage."); System.out.println("3. 5 bonus points for teacher switches in the room."); } @@ -119,7 +146,7 @@ public class App { // #region Main public static void main(String[] args) { - boolean debbugingList = true; + boolean debbugingList = false; if (debbugingList) { debbugingValueLists(room37Data); // debbugingValueLists(room38Data); @@ -127,7 +154,9 @@ public class App { } else { fillInTimeTable(); initializeTeachers(); - calculatePoints(); + calculatePoints(room37Data); + calculatePoints(room38Data); + calculatePoints(room39Data); sortTeachers(); printTeachers(); diff --git a/Code/Steiner/CO2-Daten-Projekt-V2/src/Co2Data.java b/Code/Steiner/CO2-Daten-Projekt-V2/src/Co2Data.java index 35cdbb7..5aef3cf 100644 --- a/Code/Steiner/CO2-Daten-Projekt-V2/src/Co2Data.java +++ b/Code/Steiner/CO2-Daten-Projekt-V2/src/Co2Data.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import java.util.List; public class Co2Data { + // #region Fields private Date date; private int co2Level; @@ -15,7 +16,7 @@ public class Co2Data { this.co2Level = co2Level; } - // #region Getters Setters + // #region Getters and Setters public Date getDate() { return date; } @@ -32,30 +33,26 @@ public class Co2Data { this.co2Level = co2Level; } - // #region Fetching & Parsing + // #region Data Fetching + // Method to fetch and parse CO2 data from a URL public static List getData(String csvURL, int classRoomNumber) { List dataList = new ArrayList<>(); - - // Reference date: August 11, 2024 - Date referenceDate = new Date(11, 8, 2024, 0, 0); // Set time to 00:00 as we only care about the date + Date referenceDate = new Date(11, 8, 2024, 0, 0); // Reference date: August 11, 2024 try { URL url = new URL(csvURL); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("Accept", "application/csv"); + if (conn.getResponseCode() != 200) { - throw new RuntimeException("Failed : HTTP Error code : " - + conn.getResponseCode()); + throw new RuntimeException("Failed : HTTP Error code : " + conn.getResponseCode()); } - InputStreamReader in = new InputStreamReader(conn.getInputStream()); - BufferedReader br = new BufferedReader(in); + BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream())); + br.readLine(); // Skip header line + String output; - - // Skip header line - br.readLine(); - while ((output = br.readLine()) != null) { Co2Data data = parseData(output, classRoomNumber); if (data != null && isNewerThanReferenceDate(data.getDate(), referenceDate)) { @@ -68,12 +65,12 @@ public class Co2Data { System.out.println("Exception in NetClientGet: " + e); } - return dataList; // Return the list of Co2Data objects + return dataList; } - // Helper method to compare dates + // #region Date Comparison + // Method to compare if the data date is newer than the reference date private static boolean isNewerThanReferenceDate(Date dataDate, Date referenceDate) { - // Compare year, month, and day only (ignoring the time part) if (dataDate.getYear() > referenceDate.getYear()) { return true; } else if (dataDate.getYear() == referenceDate.getYear()) { @@ -86,20 +83,18 @@ public class Co2Data { return false; } + // #region Data Parsing + // Method to parse CO2 data from a CSV line private static Co2Data parseData(String csvLine, int classRoomNumber) { String[] fields = csvLine.split(","); - if (fields.length < 5) { - return null; // Handle error or log it if needed - } + if (fields.length < 5) + return null; try { - // Extract date and time from created_at field - String createdAt = fields[0]; - String[] dateTime = createdAt.split(" "); + String[] dateTime = fields[0].split(" "); String[] dateParts = dateTime[0].split("-"); String[] timeParts = dateTime[1].split(":"); - // Create a Date object int year = Integer.parseInt(dateParts[0]); int month = Integer.parseInt(dateParts[1]); int day = Integer.parseInt(dateParts[2]); @@ -107,19 +102,18 @@ public class Co2Data { int minute = Integer.parseInt(timeParts[1]); Date date = new Date(day, month, year, hour, minute); - // Parse CO2 level (field1) int co2Level = Integer.parseInt(fields[2]); return new Co2Data(date, co2Level); - } catch (Exception e) { - System.out.println("Error parsing data: " + e); + } catch (NumberFormatException e) { return null; } } - // #region toString Override + // #region ToString Method + // Method to return a string representation of the CO2 data @Override public String toString() { - return this.date.toString() + "\n" + this.co2Level; + return "Date: " + date + ", CO2 Level: " + co2Level; } } diff --git a/Code/Steiner/CO2-Daten-Projekt-V2/src/FillTable.java b/Code/Steiner/CO2-Daten-Projekt-V2/src/FillTable.java index db5ba13..25f9aed 100644 --- a/Code/Steiner/CO2-Daten-Projekt-V2/src/FillTable.java +++ b/Code/Steiner/CO2-Daten-Projekt-V2/src/FillTable.java @@ -83,4 +83,66 @@ public class FillTable { "Friday", START_TIMES, END_TIMES, roomIndex); } + static boolean isBreak(int intHour, int intMinute) { + // Check if the time is between 7 AM and 5 PM + if (intHour >= 7 && intHour <= 17) { + // Check if the time falls between any lesson start and end times + for (int i = 0; i < START_TIMES.length; i++) { + // Split the start and end times into hours and minutes + String[] startTime = START_TIMES[i].split(":"); + String[] endTime = END_TIMES[i].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 false; // It's not a break, it's during a lesson + } + } + return true; // If no lessons match, it must be a break + } + + 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) + } + } + } + } + } + + return "No Break"; // If no break is found, return "No Break" + } + } diff --git a/Code/Steiner/CO2-Daten-Projekt-V2/src/Lesson.java b/Code/Steiner/CO2-Daten-Projekt-V2/src/Lesson.java index eaced6b..0c7ae98 100644 --- a/Code/Steiner/CO2-Daten-Projekt-V2/src/Lesson.java +++ b/Code/Steiner/CO2-Daten-Projekt-V2/src/Lesson.java @@ -1,27 +1,26 @@ public class Lesson { // #region Fields - private int roomNumberNumber; + private int roomNumber; private String teacherInitials; private String startTime; private String endTime; - private String weekweekDay; + private String weekDay; // #region Constructor - // Constructor to initialize all fields - public Lesson(int roomNumber, String teacherInitials, String startTime, String endTime, String weekweekDay) { - this.roomNumberNumber = roomNumber; + public Lesson(int roomNumber, String teacherInitials, String startTime, String endTime, String weekDay) { + this.roomNumber = roomNumber; this.teacherInitials = teacherInitials; this.startTime = startTime; this.endTime = endTime; - this.weekweekDay = weekweekDay; + this.weekDay = weekDay; } // #region Getters - public int getroomNumber() { - return roomNumberNumber; + public int getRoomNumber() { + return roomNumber; } - public String getteacherInitials() { + public String getTeacherInitials() { return teacherInitials; } @@ -33,8 +32,7 @@ public class Lesson { return endTime; } - public String getweekDay() { - return weekweekDay; + public String getWeekDay() { + return weekDay; } - } diff --git a/Code/Steiner/CO2-Daten-Projekt-V2/src/Points.java b/Code/Steiner/CO2-Daten-Projekt-V2/src/Points.java index 6a09499..1b22b1b 100644 --- a/Code/Steiner/CO2-Daten-Projekt-V2/src/Points.java +++ b/Code/Steiner/CO2-Daten-Projekt-V2/src/Points.java @@ -1,6 +1,4 @@ -// Points class for managing point categories public class Points { - // #region Fields private int fiveMinuteBreak; private int longerBreak; private int bonusPoints; @@ -31,9 +29,7 @@ public class Points { } // #region Calculation - // Method to calculate total points public int getTotalPoints() { return fiveMinuteBreak + longerBreak + bonusPoints; } - } diff --git a/Code/Steiner/CO2-Daten-Projekt-V2/src/Teacher.java b/Code/Steiner/CO2-Daten-Projekt-V2/src/Teacher.java index a747c69..633b9e6 100644 --- a/Code/Steiner/CO2-Daten-Projekt-V2/src/Teacher.java +++ b/Code/Steiner/CO2-Daten-Projekt-V2/src/Teacher.java @@ -10,6 +10,7 @@ public class Teacher { // #region Initialization static { + // Mapping short names to full teacher names nameMap.put("Hm", "Hummel"); nameMap.put("Bd", "Bender"); nameMap.put("Bu", "Burger"); @@ -32,20 +33,19 @@ public class Teacher { nameMap.put("Zu", "Zuniga"); } - // #region Constructor public Teacher(String name) { + // Use the short name to find the full name from the nameMap this.name = nameMap.getOrDefault(name, "Unknown"); - this.points = new Points(); + this.points = new Points(); // Initialize a new Points object } // #region Getters public String getName() { - return name; + return name; // Return the teacher's full name } public Points getPoints() { - return points; + return points; // Return the Points object associated with this teacher } - }