Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

RPMC-Project/.DS_Store __MACOSX/RPMC-Project/._.DS_Store RPMC-Project/pom.xml XXXXXXXXXX com.mycompany RPMC-Project XXXXXXXXXXSNAPSHOT jar XXXXXXXXXXUTF-8 XXXXXXXXXX XXXXXXXXXX...

1 answer below »
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
Answered Same Day Dec 28, 2021

Solution

Neha answered on Jan 05 2021
149 Votes
Testing
    Feature
    Sub feature
    Input
    Expected Output
    Results
    Book Appointment
    Not providing patient name
    Select option 1 from the menu. Do not enter any name when asked for patient name
    The programme should ask for patient name again if not provided
    Failed as it is asking for other informations without name
    
    Entering string as telephone numbe
    Select option 1 and enter string value for the telephone
    Programme should ask again with the message of invalid input
    Failed as programme terminates with system exception
    
    Enter char value for date of birth
    Select option 1 and enter char value for the date of birth
    The programme should show invalid input message and ask again for date of birth
    Failed as programme accepts a string any value for the date of birth
    
    Select invalid choice out of doctors
    Select option 1 and for the doctors enter 5
    The programme should inform user about invalid input and ask for doctor again
    Success as the program throws exception and terminates
Critical Report
The following report has been prepared to show and write down the experience which I have faced while working on the assignment. This report can be used as the self-reflective information for the assignment on which I've worked for developing the menu driven hospital registration application using Java language. The overall purpose of writing this report is true share my experience, approach and thoughts about the Java language which is an object-oriented programming language. Generally, the developers are using object-oriented programming language as it has multiple advantages. These languages allow the user to create a software in more reliable and convenient manner. It is easy to understand and can be reused. These types of languages are extensible and convenient according to the user.
The object-oriented programming languages allows us to create classes which makes the whole language more reliable. It allows us to create different parts of a single software and then each of them can be modified individually and it does not affect any other part of the software. The whole program or the application can be divided into multiple sub programs which makes it more convenient for the user to work on it and allows multiple users to work on the same application at the same time. The Java language allows to maintain the code easily as it allows the developer to modify the code which can be beneficial for the whole software. The Java programming language also allow the user to reuse the already created classes or the object add some other please in the whole code. The major pillars of the object-oriented programming are encapsulation, polymorphism and the inheritance. I've used these pillars in the application and the aim was to avoid any repetition of the code and achieve the re usability.
Encapsulation
Encapsulation allows the developer to encapsulate the classes which means we can encase the methods and attribute of each...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here