RPMC-Project/.DS_Store
__MACOSX/RPMC-Project/._.DS_Store
RPMC-Project/pom.xml
XXXXXXXXXX
com.mycompany
RPMC-Project
XXXXXXXXXXSNAPSHOT
ja
XXXXXXXXXXUTF-8
XXXXXXXXXX
XXXXXXXXXX
RPMC-Project/src/.DS_Store
__MACOSX/RPMC-Project/src/._.DS_Store
RPMC-Project/src/test/.DS_Store
__MACOSX/RPMC-Project/src/test/._.DS_Store
RPMC-Project/src/main/.DS_Store
__MACOSX/RPMC-Project/src/main/._.DS_Store
RPMC-Project/src/main/java/.DS_Store
__MACOSX/RPMC-Project/src/main/java/._.DS_Store
RPMC-Project/src/main/java/Doctor.java
RPMC-Project/src/main/java/Doctor.java
import of all the classes of the utility package
import java.util.*;
public class Doctor {
   Â
variable for storing doctor's name
    String name;
       Â
Create a HashSet object called timeslot
    HashSet
 timeslots=new HashSet();
       Â
      Â
A
ayList for each patient
    A
ayList patients=new A
ayList();
       Â
contructo
    public Doctor(String name) {
        this.name = name;
    }
       Â
class for adding the time given by the use
    public void addtime(String timeslot,Patient p){
        timeslots.add(timeslot);
        patients.add(p);
    }
       Â
end class
}
__MACOSX/RPMC-Project/src/main/java/._Doctor.java
RPMC-Project/src/main/java/Main.java
RPMC-Project/src/main/java/Main.java
import of all the classes of the input and output package
import java.io.*;
import of all the classes of the utility package
import java.util.*;
public class Main {
   Â
throw IOException for input and output operation
    public static void main(String[] args) throws IOException{
           Â
           Â
declaration of BufferedReade
        BufferedReaderÂ
=new BufferedReader(new InputStreamReader(System.in));
               Â
               Â
use of a
ays for declaring the 4 doctors available.
        Doctor doctors[]=new Doctor[4];
        doctors[0]=new Doctor("Dr. Daniel Hagan");
        doctors[1]=new Doctor("Dr. Bravo Gilbert");
        doctors[2]=new Doctor("Dr. Steven Seagal");
        doctors[3]=new Doctor("Dr. Igor Dondon");
               Â
               Â
use of a
aylist for registering patients
        A
ayList patients=new A
ayList();
               Â
               Â
start of while loop
        while(true){
                   Â
menu with options for the use
            System.out.println("    Rotten Park Medical Centre (RPMC)    ");
            System.out.println("1.\tBook an appointment.");
            System.out.println("2.\tCancel an appointment.");
            System.out.println("3.\tView a doctor's schedule.");
            System.out.println("4.\tView a patient's appointment.");
            System.out.println("5.\tExit");
            System.out.println("Please enter an option......");
                       Â
            int ch=Integer.parseInt(
.readLine());
                       Â
                   Â
use of switch statements for displaying sub-menus or messages for the user input   Â
            switch(ch)
            {  Â
case 1 for booking appointment
                case 1:
                                   Â
variables for storing patient details input
                    String FirstName,Surname,DateofBirth,CountryofOrigin,timeslot;
                    long telephone; int count=0;
                                       Â
                                  Â
enter patient's details by using bufferedreade
                    System.out.println("\tBook an appointment");
                    System.out.println("Enter First Name: ");Â
                                        FirstName=
.readLine();
                    System.out.println("Enter Surname: ");Â
                                        Surname=
.readLine();
                    System.out.println("Enter Telephone: ");Â
                                        telephone=Long.parseLong(
.readLine());
                    System.out.println("Enter Date of Birth: ");Â
                                        DateofBirth=
.readLine();
                    System.out.println("Enter Country of Origin: ");Â
                                        CountryofOrigin=
.readLine();
                    System.out.println("Select time slot");
                                        timeslot=
.readLine();Â
                    System.out.println("Doctors available at this timeslot are:");
                                       Â
                                     Â
use of for-loop for displaying available doctors for a particular timeslot
                    for(int i=0;i                        if(doctors[i].timeslots==null || (!doctors[i].timeslots.contains(timeslot))){
                            if(doctors[i].patients.size()<7){
                                System.out.println((i+1)+". "+doctors[i].name);
                                count++;
                            }
                        }
                    }
                                       Â
displaying message for input of 0
                    if(count==0)
                        System.out.println("No Doctors are available at this timeslot");
                                       Â
                                       Â
choosing docto
                    else{
                        System.out.println("Enter your choice");
                        int cc=Integer.parseInt(
.readLine());
                                               Â
                                               Â
egistering patient's  details
                        patients.add(new Patient(FirstName,Surname,telephone,DateofBirth,CountryofOrigin,timeslot,doctors[cc-1]));
                                               Â
                                               Â
adding patient booking to the doctor's schedule.
                        doctors[cc-1].addtime(timeslot,new Patient(FirstName,Surname,telephone,DateofBirth,CountryofOrigin,timeslot,doctors[cc-1]));
                        System.out.println("Booking succesful");
                    }
                   Â
eak;
                                       Â
                                    Â
case 2 for cancelling appointment
                case 2:
                    System.out.println("Enter the First name of the patient");
                    String fname=
.readLine();
                    System.out.println("Enter the Surname of the patient");
                    String sname=
.readLine();
                    for(int i=0; i                        Patient p=patients.get(i);
                                Â
if name and surname of the patient details booked equals to the details given by user, cancel appointment.          Â
                        if(p.FirstName.equalsIgnoreCase(fname) && p.Surname.equalsIgnoreCase(sname)){
                            p.doctor.timeslots.remove(p.timeslot);
                            p.doctor.patients.remove(p);
                            patients.remove(p);
                        }
                    }
                    System.out.println("Appointment cancelled");
                   Â
eak;
                                       Â
                                       Â
case 3 for viewing doctors schedule
                case 3:
                    System.out.println("List of doctors");
                                       Â
                                       Â
use of the for-loop for viewing doctors.
                    for(int i=0;i                        System.out.println((i+1)+". "+doctors[i].name);
                    System.out.println("Enter your choice");
                                       Â
                                       Â
choosing doctor to view schedule
                    int d_id=Integer.parseInt(
.readLine());
                                       Â
                                       Â
message for wrong input
                    if(d_id>4 && d_id<1){
                        System.out.println("Wrong choice");
                       Â
eak;
                    }
                                       Â
viewing patients booked with the particular docto
                    for(Patient p : doctors[d_id-1].patients)
                        System.out.println(p.timeslot+" : "+p.FirstName);
                   Â
eak;
                                       Â
                                       Â
case 4 shows the patients booking details
                case 4:
                    System.out.println("Enter the First name of the patient");
                    String finame=
.readLine();
                    System.out.println("Enter the Surname of the patient");
                    String suname=
.readLine();
                    for(Patient p  : patients){
                                     Â
if name and surname of the patient details booked equals to the details given by user, print details.
                        if(p.FirstName.equalsIgnoreCase(finame) && p.Surname.equalsIgnoreCase(suname))
                            System.out.println(p);
                    }
                   Â
eak;
                               Â
case 5 for exiting the program
                case 5:
                    System.out.println("Thank you");
                    System.exit(0);
                                       Â
                               Â
displaying message for wrong inputÂ
                default:
                    System.out.println("Option not available!!!\nPlease try again");
            }
        }
    }
       Â
end class
}
__MACOSX/RPMC-Project/src/main/java/._Main.java
RPMC-Project/src/main/java/Patient.java
RPMC-Project/src/main/java/Patient.java
public class Patient {
   Â
variables for patient details
   Â
    String FirstName;
    String Surname;
    long Telephone;
    String Dob;
    String country;
    String timeslot;
    Doctor doctor;
       Â
       Â
constructo
    public Patient(String firstName, String surname, long telephone,
            String dob, String country, String timeslot, Doctor doctor) {
           Â
           Â
parse the variables into constructor and reverse
        super();
        FirstName = firstName;
        Surname = surname;
        Telephone = telephone;
        Dob = dob;
        this.country = country;
        this.timeslot = timeslot;
        this.doctor = doctor;
    }
       Â
this method ove
ides super-class / implements super-class's methods
    @Ove
ide
    public String toString() {
        return "Patient Details:\n" +
        "FirstName: " + FirstName +Â
        "\nSurname: " + Surname +
        "\nTelephone: " + String.valueOf(Telephone) +Â
        "\nDate of Birth: " + Dob +Â
        "\nCountry of Origin: "+ country +Â
        "\nTime of the appointment: " + timeslot +Â
        "\nDoctor registered: " + doctor.name;
    }
       Â
end class
}
RPMC-Project/src/main/java/com/.DS_Store
__MACOSX/RPMC-Project/src/main/java/com/._.DS_Store
RPMC-Project/src/main/java/com/mycompany/.DS_Store
__MACOSX/RPMC-Project/src/main/java/com/mycompany/._.DS_Store
RPMC-Project/src/main/java/com/mycompany
pmc/.DS_Store
__MACOSX/RPMC-Project/src/main/java/com/mycompany
pmc/._.DS_Store