Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2899739
initial commit, project setup
BennettDeveloper Feb 20, 2026
bb75b2e
feat: adding class data and main menu
BennettDeveloper Feb 22, 2026
805409a
feat: added nav menus for main menu and patient viewer menu
BennettDeveloper Feb 22, 2026
6768c44
feat: completed patient search functionality
BennettDeveloper Feb 23, 2026
4bed7f7
feat: finished patient check-in functionality
BennettDeveloper Feb 23, 2026
6849047
Merge pull request #1 from BennettDeveloper/cbennett-dev
BennettDeveloper Feb 23, 2026
b04848a
Car Appointment class built
wainswo302 Feb 23, 2026
947ceec
update car appointment and shop scheduler
whblue261 Feb 23, 2026
d6d1dc0
Merge pull request #2 from BennettDeveloper/FredsBranch
wainswo302 Feb 23, 2026
c36ae96
fixed merged conflicts
whblue261 Feb 23, 2026
aef4ad7
Merge pull request #3 from BennettDeveloper/maxx
whblue261 Feb 23, 2026
5fb9dc3
fix: implementing new time slot class
BennettDeveloper Feb 23, 2026
732dd14
Merge pull request #4 from BennettDeveloper/cbennett-dev
BennettDeveloper Feb 23, 2026
6b6d883
feat: Added Appointment viewer functionality
BennettDeveloper Feb 23, 2026
6629f7a
fix: Fixed adding appointments and printing appointment with timestamps
BennettDeveloper Feb 23, 2026
d23fc6e
Merge pull request #5 from BennettDeveloper/cbennett-dev
BennettDeveloper Feb 23, 2026
fea2fc6
Added instance counter to CarPatient.java and CarAppointment.java and…
wainswo302 Feb 23, 2026
4437928
Merge pull request #6 from BennettDeveloper/FredsBranch
wainswo302 Feb 23, 2026
599cd49
update tier 3 waitlist
whblue261 Feb 23, 2026
17776e6
fix merge conflicts for waitlist,shop scheduler
whblue261 Feb 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Mechanic Shop/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Mechanic Shop/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions Mechanic Shop/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 88 additions & 0 deletions src/main/java/org/codedifferently/CarAppointment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package org.codedifferently;

import org.codedifferently.data.TimeSlot;

import java.sql.Array;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.UUID;

public class CarAppointment {

private String appointmentID;

private static final LocalTime OPEN_TIME = LocalTime.of(7,0);
private static final LocalTime CLOSE_TIME = LocalTime.of(21,0);
private static final LocalTime LAST_APPOINTMENT = LocalTime.of(20,0);
private CarPatient carPatient;
private TimeSlot timeSlot;
private boolean isCompleted;
private String serviceType;
private static int instanceCounter;
{
instanceCounter++;
}
public static int getInstanceCounter() {
return instanceCounter;
}

public boolean isCompleted() {
return isCompleted;
}

public boolean isDuringBusinessHours(TimeSlot timeSlot){
LocalTime startTime = timeSlot.getStart().toLocalTime();
LocalTime endTime = timeSlot.getEnd().toLocalTime();

return startTime.isAfter(OPEN_TIME) && endTime.isBefore(CLOSE_TIME);
}
public CarAppointment(CarPatient carPatient, TimeSlot timeSlot, String serviceType){
this.carPatient = carPatient;
this.timeSlot = timeSlot;
this.serviceType= serviceType;
appointmentID = UUID.randomUUID().toString().substring(0, 6);
}

public CarAppointment(CarPatient carPatient, TimeSlot timeSlot){
if(isDuringBusinessHours(timeSlot)){
this.carPatient = carPatient;
this.timeSlot = timeSlot;
} else {
System.out.println("Appointment must be between our business hours of 7am-9pm");
}
}

public String getAppointmentID() {
return appointmentID;
}

public void setAppointmentID(String appointmentID) {
this.appointmentID = appointmentID;
}

public TimeSlot getTimeSlot() {
return timeSlot;
}

public void setTimeSlot(TimeSlot timeSlot) {
this.timeSlot = timeSlot;
}

public String getServiceType() {
return serviceType;
}

public void setServiceType(String serviceType) {
this.serviceType = serviceType;
}

public CarPatient getCarPatient() {
return carPatient;
}

public void setCarPatient(CarPatient carPatient) {
this.carPatient = carPatient;
}

}
155 changes: 155 additions & 0 deletions src/main/java/org/codedifferently/CarClinicApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
package org.codedifferently;

import org.codedifferently.data.TimeSlot;
import org.codedifferently.helpers.InputHandler;
import org.codedifferently.helpers.PatientHandler;

import java.util.Scanner;

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class CarClinicApp {
public static void main(String[] args) {

CarClinicApp carClinicApp = new CarClinicApp();
CarClinicSystem carClinicSystem = new CarClinicSystem();

carClinicApp.handleMainMenu(carClinicSystem);

}

void handleMainMenu(CarClinicSystem carClinicSystem) {

boolean inMainMenu = true;
while(inMainMenu) {

System.out.println("Welcome to the CWW Auto Repair Shop.");
System.out.println("What would you like to do today?");

System.out.println("-------------------------------------");
System.out.println("1. View Car Patients");
System.out.println("2. View Car Appointments");
System.out.println("3. Check Summary Reports");
System.out.println("4. Exit");
System.out.println("-------------------------------------");

//Call Static Method to handle Integer input
int scanInput = InputHandler.handleIntegerInput();

switch (scanInput) {
case 1:
handlePatientMenu(carClinicSystem);
break;
case 2:
handleAppointmentMenu(carClinicSystem);
break;
case 4:
inMainMenu = false;
System.out.println("Alright, have a nice day!");
break;
default:
System.out.println("That's not an option on our menu! Please try again!");
break;
}
}
}

void handlePatientMenu(CarClinicSystem carClinicSystem) {

boolean inPatientMenu = true;
while(inPatientMenu) {
System.out.println("-------------------------------------");
System.out.println("Patient Viewer");
System.out.println("We appreciate your patience, Patient!");
System.out.println("What would you like to do today?");
System.out.println("-------------------------------------");
System.out.println("1. Add patient");
System.out.println("2. View all patients");
System.out.println("3. Check in patient");
System.out.println("4. Search for patient");
System.out.println("5. Exit");
System.out.println("-------------------------------------");

int scanInput = InputHandler.handleIntegerInput();

PatientHandler patientHandler = new PatientHandler();

switch(scanInput) {
case 1:
patientHandler.promptNewPatient(carClinicSystem);
break;
case 2:
patientHandler.viewAllPatients(carClinicSystem);
break;
case 3:
patientHandler.checkInPatient(carClinicSystem);
break;
case 4:
patientHandler.printSearchedPatient(carClinicSystem);
break;
case 5:
System.out.println("Exiting out of Patient Menu!");
inPatientMenu = false;
break;
default:
System.out.println("Thats not an option on our menu, please try again.");
}
}

}

void handleAppointmentMenu(CarClinicSystem carClinicSystem) {

boolean inAppointmentMenu = true;
while(inAppointmentMenu) {
System.out.println("-------------------------------------");
System.out.println("Appointment Viewer");
System.out.println("You have reached A POINT meant in time.");
System.out.println("What would you like to do today?");
System.out.println("-------------------------------------");
System.out.println("1. View Timeslots");
System.out.println("2. Schedule an appointment");
System.out.println("3. Cancel an appointment.");
System.out.println("4. Exit");
System.out.println("-------------------------------------");

int scanInput = InputHandler.handleIntegerInput();

PatientHandler patientHandler = new PatientHandler();

ShopScheduler shopScheduler = new ShopScheduler();

switch(scanInput) {
case 1:
shopScheduler.printSchedule(carClinicSystem);
break;
case 2:
CarPatient patient = patientHandler.searchForPatient(carClinicSystem);
if(patient == null) {
System.out.println("Patient was not found!!!");
//Create new patient if not found.
patient = patientHandler.promptNewPatient(carClinicSystem);
}
TimeSlot timeSlot = shopScheduler.promptTimeSlot();
String serviceType = shopScheduler.promptServiceType();
shopScheduler.scheduleAppointment(carClinicSystem, patient, timeSlot, serviceType);
break;
case 3:
System.out.println("Give me the appointment ID that you want to cancel: ");
String appointmentID = InputHandler.handleStringInput();
shopScheduler.cancelAppointment(carClinicSystem, appointmentID);
break;
case 4:
System.out.println("Exiting out of Patient Menu!");
System.out.println("End of day summary report.");
System.out.println("Number of appointments created: " + CarAppointment.getInstanceCounter());
System.out.println("Number of customers added to system: " + CarPatient.getInstanceCounter());
inAppointmentMenu = false;
break;
default:
System.out.println("Thats not an option on our menu, please try again.");
}
}

}
}
22 changes: 22 additions & 0 deletions src/main/java/org/codedifferently/CarClinicSystem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.codedifferently;

import java.util.ArrayList;

public class CarClinicSystem {

private ArrayList<CarAppointment> carAppointments = new ArrayList<>();
private ArrayList<CarPatient> carPatients = new ArrayList<>();

private final Waitlist waitlist = new Waitlist();

public Waitlist getWaitlist() {
return waitlist;
}
public ArrayList<CarAppointment> getCarAppointments() {
return carAppointments;
}

public ArrayList<CarPatient> getCarPatients() {
return carPatients;
}
}
Loading