diff --git a/src/main/java/org/codedifferently/Main.java b/src/main/java/org/codedifferently/Main.java
index 435139b..bdc90b8 100644
--- a/src/main/java/org/codedifferently/Main.java
+++ b/src/main/java/org/codedifferently/Main.java
@@ -1,17 +1,149 @@
package org.codedifferently;
-//TIP To Run code, press or
+import java.util.Scanner;
+
+//TIP To Run code, press
// click the icon in the gutter.
public class Main {
public static void main(String[] args) {
- //TIP Press with your caret at the highlighted text
- // to see how IntelliJ IDEA suggests fixing it.
- System.out.printf("Hello and welcome!");
-
- for (int i = 1; i <= 5; i++) {
- //TIP Press to start debugging your code. We have set one breakpoint
- // for you, but you can always add more by pressing .
- System.out.println("i = " + i);
+
+
+ MaintenanceRequest main = new MaintenanceRequest();
+ MaintenanceRequest mR1 = new MaintenanceRequest("Derwin", 101, "Plumbing", 2);
+ MaintenanceRequest mR2 = new MaintenanceRequest("Dill", 121, "Electric", 5);
+ MaintenanceRequest mR3 = new MaintenanceRequest("James", 134, "HVAC", 1);
+
+
+ main.maintenanceReq(mR1);
+ main.maintenanceReq(mR2);
+ main.maintenanceReq(mR3);
+
+ main.requestList();
+
+ maintenanceApp(main);
+
+
+ }
+
+ public static void maintenanceApp(MaintenanceRequest maintenanceRequest) {
+ Scanner scan = new Scanner(System.in);
+ String playAgain;
+
+ do {
+
+ System.out.println("Welcome to Maintenance");
+ System.out.println("""
+ 1. Add New Customer
+ 2. Add New Technician
+ 3. Daily Report
+ """);
+ int choice = scan.nextInt();
+
+ switch (choice) {
+ case 1:
+ System.out.println("Enter Tenant's Name: ");
+ String TenantName = scan.next();
+ System.out.println("Enter Apt #: ");
+ int apt = scan.nextInt();
+ System.out.println("Enter Issue Type: ");
+ String issueType = scan.next();
+ System.out.println("Enter Severity #: ");
+ int severity = scan.nextInt();
+ MaintenanceRequest maintenance = new MaintenanceRequest(TenantName, apt, issueType, severity);
+ maintenanceRequest.maintenanceReq(maintenance);
+ maintenanceRequest.requestList();
+
+ break;
+ case 2:
+
+ System.out.println("WE NEED TECHNICIANS, WHAT YOUR NAME? YOU'RE A TECHNICIAN NOW");
+ String TechnicianName = scan.next();
+ MaintenanceOffice technician = new MaintenanceOffice(TechnicianName);
+ techWork(technician, maintenanceRequest);
+
+
+ case 3:
+ maintenanceRequest.dailyReport();
+ break;
+
+
+ default:
+
+ System.out.println("Invalid Input.");
+ break;
+ }
+
+
+
+
+
+ while (true) {
+ System.out.print("Done? (say Done/No): ");
+ playAgain = scan.next().toLowerCase();
+
+ if (playAgain.equals("no") || playAgain.equals("done")) {
+ break;
+ } else {
+ System.out.println("Invalid input!");
+
+ }
+ }
+
+
+ }while(playAgain.equals("no"));
+}
+
+
+
+ public static void techWork(MaintenanceOffice technician, MaintenanceRequest mR){
+
+ Scanner scan = new Scanner(System.in);
+
+ while (true) {
+
+ // If list is empty, stop
+ if (mR.getMaintenanceRequests().isEmpty()) {
+ System.out.println("\nNo more requests. All caught up!");
+ break;
+ }
+
+ System.out.println("\n--- CURRENT REQUESTS ---");
+
+ // Print starting from 1 for the user
+ for (int i = 0; i < mR.getMaintenanceRequests().size(); i++) {
+ System.out.println((i + 1) + ") " + mR.getMaintenanceRequests().get(i));
+ }
+
+ System.out.println("\nChoose a request number to work on (or type -1 to stop): ");
+ int option = scan.nextInt();
+
+ if (option == -1) {
+ System.out.println("Stopping work session.");
+ break;
+ }
+
+ // Convert user input to 0-based index
+ int index = option - 1;
+
+ // Validate choice
+ if (index < 0 || index >= mR.getMaintenanceRequests().size()) {
+ System.out.println("Invalid choice.");
+ continue;
+ }
+
+ // Work on it ONE time (NEW->IN_PROGRESS or IN_PROGRESS->DONE)
+ technician.workOneRequest(mR.getMaintenanceRequests(), index);
+
+ // After working, check if it is DONE, then remove it
+ if (mR.getMaintenanceRequests().get(index).getStatus().equals("DONE")) {
+
+ System.out.println("\nRequest is DONE. Removing it from the list...");
+ mR.getMaintenanceRequests().remove(index);
+
+ System.out.println("Removed.");
+ }
}
}
-}
\ No newline at end of file
+}
+
+
diff --git a/src/main/java/org/codedifferently/MaintenanceOffice.java b/src/main/java/org/codedifferently/MaintenanceOffice.java
new file mode 100644
index 0000000..907b011
--- /dev/null
+++ b/src/main/java/org/codedifferently/MaintenanceOffice.java
@@ -0,0 +1,72 @@
+package org.codedifferently;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class MaintenanceOffice {
+
+ private String technician;
+
+
+
+ public MaintenanceOffice(String technician) {
+ this.technician = technician;
+
+ }
+
+ public String updateStat(String problem){
+ if (problem.equals("NEW")){
+
+ return "IN_PROGRESS";
+ }
+ else if (problem.equals("IN_PROGRESS")){
+ return "DONE";
+ }
+
+ return problem;
+
+ }
+
+ // Work on ONE request by index (one step only)
+ public void workOneRequest(ArrayList requests, int index) {
+
+ if (index < 0 || index >= requests.size()) {
+ System.out.println("Invalid choice.");
+ return;
+ }
+
+ MaintenanceRequest r = requests.get(index);
+
+ String before = r.getStatus();
+ String after = updateStat(before);
+
+ // only allowed statuses
+ if (!isValidStatus(after)) {
+ System.out.println("Invalid status change attempted.");
+ return;
+ }
+
+ r.setStatus(after);
+
+ System.out.println("\nUpdated Request:");
+ System.out.println(r); // shows NEW/IN_PROGRESS/DONE
+ }
+
+ private boolean isValidStatus(String status) {
+ return status.equals("NEW") || status.equals("IN_PROGRESS") || status.equals("DONE");
+ }
+
+
+
+ public String getTechnician() {
+ return technician;
+ }
+
+
+
+ public void setTechnician(String technician) {
+ this.technician = technician;
+ }
+
+
+}
diff --git a/src/main/java/org/codedifferently/MaintenanceRequest.java b/src/main/java/org/codedifferently/MaintenanceRequest.java
new file mode 100644
index 0000000..91ca494
--- /dev/null
+++ b/src/main/java/org/codedifferently/MaintenanceRequest.java
@@ -0,0 +1,181 @@
+package org.codedifferently;
+
+import java.util.ArrayList;
+
+public class MaintenanceRequest {
+
+ private String tenantName;
+
+ private int apartmentNumber;
+
+ private String issueType;
+
+ private int severity;
+
+ private String status = "NEW";
+
+ private final ArrayList maintenanceRequests = new ArrayList<>();
+
+
+ public MaintenanceRequest(){
+
+ }
+
+ public MaintenanceRequest(String tenantName, int apartmentNumber, String issueType, int severity) {
+ this.tenantName = tenantName;
+ this.apartmentNumber = apartmentNumber;
+ this.issueType = issueType;
+ this.severity = severity;
+
+ }
+
+ public void maintenanceReq(MaintenanceRequest mR){
+ maintenanceRequests.add(mR);
+ }
+
+
+ public void requestList() {
+
+ // Sort requests by severity
+
+ maintenanceRequests.sort((r1, r2) ->
+ Integer.compare(r2.getSeverity(), r1.getSeverity())
+ );
+
+ System.out.println("\n--- MAINTENANCE REQUESTS ---");
+
+ for (int i = 0; i < maintenanceRequests.size(); i++) {
+ System.out.println(i + ") " + maintenanceRequests.get(i));
+ }
+ }
+
+ public void dailyReport() {
+
+ int total = maintenanceRequests.size();
+
+ int open = 0;
+ int closed = 0;
+
+ int low = 0; // severity 1-2
+ int medium = 0; // severity 3
+ int high = 0; // severity 4-5 , "HIGH PRIORITY"
+ int highPriority = 0;
+
+ // Track most common issue type
+ String mostCommonIssue = "N/A";
+ int mostCommonCount = 0;
+
+ // Simple frequency tracking with two ArrayLists
+ ArrayList issueNames = new ArrayList<>();
+ ArrayList issueCounts = new ArrayList<>();
+
+ for (MaintenanceRequest r : maintenanceRequests) {
+
+ // Open vs Closed
+ // DONE = closed
+ if (r.getStatus().equals("DONE")) {
+ closed++;
+ } else {
+ open++;
+ }
+
+ // Severity buckets
+ if (r.getSeverity() <= 2) {
+ low++;
+ } else if (r.getSeverity() == 3) {
+ medium++;
+ } else {
+ high++;
+ highPriority++; // severity 4-5
+ }
+
+ // Count issue types
+ String issue = r.getIssueType();
+
+ int foundIndex = -1;
+ for (int i = 0; i < issueNames.size(); i++) {
+ if (issueNames.get(i).equalsIgnoreCase(issue)) {
+ foundIndex = i;
+ break;
+ }
+ }
+
+ if (foundIndex == -1) {
+ issueNames.add(issue);
+ issueCounts.add(1);
+ } else {
+ issueCounts.set(foundIndex, issueCounts.get(foundIndex) + 1);
+ }
+ }
+
+ // Find most common issue type
+ for (int i = 0; i < issueNames.size(); i++) {
+ if (issueCounts.get(i) > mostCommonCount) {
+ mostCommonCount = issueCounts.get(i);
+ mostCommonIssue = issueNames.get(i);
+ }
+ }
+
+ // Print report
+ System.out.println("\n--- DAILY MAINTENANCE REPORT ---");
+ System.out.println("Total Requests: " + total);
+ System.out.println("Open Requests: " + open);
+ System.out.println("Closed Requests: " + closed);
+
+ System.out.println("\nLow Severity (1-2): " + low);
+ System.out.println("Medium Severity (3): " + medium);
+ System.out.println("High Severity (4-5): " + high);
+
+ System.out.println("\nMost Common Issue: " + mostCommonIssue);
+
+ // Overload warning
+ if (highPriority > 3) {
+ System.out.println("\nWARNING: Maintenance team overloaded with high priority requests!");
+ }
+ }
+
+ public String getTenantName() {
+ return tenantName;
+ }
+
+ public int getApartmentNumber() {
+ return apartmentNumber;
+ }
+
+ public String getIssueType() {
+ return issueType;
+ }
+
+ public int getSeverity() {
+ return severity;
+ }
+
+ public String getStatus() {
+
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public ArrayList getMaintenanceRequests() {
+ return maintenanceRequests;
+ }
+
+ public String toString() {
+
+ String priority = "";
+
+ if (severity >= 4) {
+ priority = " HIGH_PRIORITY";
+ }
+
+ return "Tenant: " + tenantName
+ + " | Apt: " + apartmentNumber
+ + " | Issue: " + issueType
+ + " | Severity: " + severity
+ + " | Status: " + status
+ + priority;
+ }
+}
diff --git a/src/main/java/test.puml b/src/main/java/test.puml
new file mode 100644
index 0000000..f2cda62
--- /dev/null
+++ b/src/main/java/test.puml
@@ -0,0 +1,27 @@
+@startuml
+'https://plantuml.com/class-diagram
+
+abstract class AbstractList
+abstract AbstractCollection
+interface List
+interface Collection
+
+List <|-- AbstractList
+Collection <|-- AbstractCollection
+
+Collection <|- List
+AbstractCollection <|- AbstractList
+AbstractList <|-- ArrayList
+
+class ArrayList {
+Object[] elementData
+size()
+}
+
+enum TimeUnit {
+DAYS
+HOURS
+MINUTES
+}
+
+@enduml
\ No newline at end of file