Question

In: Computer Science

java program You are required to implement a Patient Information System for a clinic according to...

java program

You are required to implement a Patient Information System for a clinic according to the following specifications:

  • Class #1 PatientRecords (Tester class with main):

This class contains a full list of patients (array list) and it provides the following functionalities:

  • Add patient by ID-Number

  • Print all records

  • Print the number of patients based on specific attributes such as: disease name, gender.

***** See examples below for the input format (use console)

  • Class #2 Patient:

This class contains personal information about each patient. It consists of the following fields (private):

  • Patient’s name

  • Patient’s age

  • Patient’s gender

  • Patient’s date of last visit

  • Patient’s disease and syndromes.

  • Patient’s status (waiting-for-analysis-results, on-medication, healed)

    The class should provide a printRecord method for each patient.

  • Class #3 Disease:

This class describes the basic information of a disease. It consists of the following fields:

  • Disease’s name

  • Array List of syndromes (such as fever, general weakness, …)

Examples of commands:

  • add ID-Number                          ex:add 89548856
    This command adds a new patient with ID = 89548856 to the record. (If the ID is already in the list, print an error message).

  • SetInfo ID-Number name, gender, age           ex:setInfo 89548856 “Ali”, “male”, 35

  • Set ID-Number attribute value                      ex:set 89548856 date “16/10/2020"
                                                                            set 89548856 disease “flu”                                                                         set 89548856 status “healed”

  • Adds ID-Number value                                ex:adds 89548856 “fever”
    -- Adds means add syndrome

  • Print-record ID-Number                              ex:print-record 89548856

  • This command prints the full details of the patient (in a clear format of your choice).

  • Print-all

This command prints a table of all patients in the list (names, age and date of last visit)

  • Print-all attribute value   ex:print-all gender “male”
    This command prints the count of all male patients in the list

print-all disease “flu”
Print-all status “on-medication”

General Notes:

  • All commands are case insensitive.

  • You are responsible for building a user-friendly console application (error messages, clear menu, input validation, ...)

  • Use any suitable and useful OOP techniques (composition, enum, inheritance, ...)

Solutions

Expert Solution

//Doctor.java

public class Doctor extends SalariedEmployee

{

               private String speclist;

               private double fees;

               public Doctor()

               public Doctor(String theName, Date theDate, double theSalary, String thespeclist,double theFee)

               public Doctor(Doctor otherDoctor)

               public void setspeclist(String newspeclist)

               public void setfees(double newfees)

               public String getspeclist()

               public double getfees()

               public boolean equals(Doctor other)

               public String toString()

}

              

//Person.java

public class Person

{

               private String personName;

               public Person()

               public Person(String thepersonName)

               public Person(Person theObject)

               public String getpersonName()

               public void setpersonName(String thepersonName)

               public String toString()

               public boolean equals(Object other)

}

// Patient.java

public class Patient extends Person

{

               private Doctor physician;

               //Default constructor

                               public Patient()

                               {

                                              super();

                                              physician = new Doctor();

                               }

                               //Constructor with parameters

                               public Patient(String name, Doctor aDoctor)

                               {

                                              super(name);

                                              physician = aDoctor;

                                              }

                               //method setDocotor

                               public void setDoctor(Doctor newDoctor)

               {

                               physician = newDoctor;

               }            

                               //method Doctor

                               public Doctor getPhysician()

                               {

                                              return physician;

                               }

                               public String toString()

                               {

                                              return super.toString() + ", Physician: "                + physician.getName();

                               }

                               public boolean equals(Patient other)

                               {

                                              return super.equals(other) &&

                                                                physician.equals(other.physician);

                               }

}

//Billing.java

public class Billing

{

               private Patient patient;

               private Doctor physician;

               private double amount;

               //Default constructor

                               public Billing()

                               {

                                              patient = new Patient();

                                              physician = new Doctor();

                                              amount = 0;

                               }

                               //Constructor with parameters

                               public Billing(Patient thePatient, Doctor thePhysician,

               double amount)

                               {

                                              patient = thePatient;

                                              physician = thePhysician;

                                              amount = amount;

                               }

                               public void setPatient(Patient newPatient)

                               {

                                              patient = newPatient;

                               }

                               public void setPhysician(Doctor newPhysician)

                               {

                                              physician = newPhysician;

                               }

                               public void setamount(double newAmount)

                               {

                                              amount = newAmount;

                               }

                               public Patient getPatient()

                               {

                                              return patient;

                               }

                               public Doctor getPhysician()

                               {

                                              return physician;

                               }

                               public double getamount()

                               {

                                              return amount;

                               }

                               public String toString()

                               {

                                              return "Patient: " + patient.toString() +                ", Physician: " + physician.getName() +

               ", Fee: $" + amount;

                               }

                               public boolean equals(Billing other)

                               {

                                              return patient.equals(other.patient) &&

                                                                physician.equals(other.physician) &&

                                                                amount == other.amount;

                               }

               }

                              

//main class, PersonDemo.java

public class PersonDemo {

    public static void main(String args[]) {

        // Take Date code from Display 4.13 in the text book

        // textbook

        Doctor p1 = new Doctor("Peter Mark", new Date(4, 30, 1995), 75000, "Physician", 85);

        Doctor p2 = new Doctor("Josh Samuel", new Date(2, 12, 1990), 88000, "Physician", 90);

        Patient p3 = new Patient("Sam Peter", p1);

        Patient p4 = new Patient("Rob Mehar", p2);

        Billing p5 = new Billing(p3, p1, p1.getOfficeFee());

        Billing p6 = new Billing(p4, p2, p2.getOfficeFee());

        System.out.println("Record 1:");

        System.out.println(p5);

        System.out.println("Record 2:");

        System.out.println(p6);

        System.out.println("Total due amount: $" + (p5.getDueAmount() + p6.getDueAmount()));

    }

}


Output:

Record 1:

Patient: Peter Mark, Physician: Josh Samuel, Fee: $85.0

Record 2:

Patient: Sam Peter, Physician: Rob Mehar, Fee: $90.0

Total due amount: $175.0


Related Solutions

Please do this in java program. In this assignment you are required to implement the Producer...
Please do this in java program. In this assignment you are required to implement the Producer Consumer Problem . Assume that there is only one Producer and there is only one Consumer. 1. The problem you will be solving is the bounded-buffer producer-consumer problem. You are required to implement this assignment in Java This buffer can hold a fixed number of items. This buffer needs to be a first-in first-out (FIFO) buffer. You should implement this as a Circular Buffer...
In this project, you are required to write the java program “IO.java” to implement integer operations...
In this project, you are required to write the java program “IO.java” to implement integer operations “+”, “−”, “*”. Specifically, your program reads operands from a file named “input.txt” (which will be manually placed under the directory of the program) as strings. Then your program converts strings to integers, and computes the addition, subtraction, and multiplication of the operands. Finally, your program creates a file named “output.txt” (under the directory of the program) and writes the results to the file....
Java-- For this homework you are required to implement a change calculator that will provide the...
Java-- For this homework you are required to implement a change calculator that will provide the change in the least amount of bills/coins. The application needs to start by asking the user about the purchase amount and the paid amount and then display the change as follows: Supposing the purchase amount is $4.34 and the paid amount is $20, the change should be: 1 x $10 bill 1 x $5 bill 2 x Quarter coin 1 x Dime coin 1...
This is for a java program. Payroll System Using Inheritance and Polymorphism 1. Implement an interface...
This is for a java program. Payroll System Using Inheritance and Polymorphism 1. Implement an interface called EmployeeInfo with the following constant variables: FACULTY_MONTHLY_SALARY = 6000.00 STAFF_MONTHLY_HOURS_WORKED = 160 2. Implement an abstract class Employee with the following requirements: Attributes last name (String) first name (String) ID number (String) Sex - M or F Birth date - Use the Calendar Java class to create a date object Default argument constructor and argument constructors. Public methods toString - returning a string...
4 Implement a Java program that meets the following requirements • You can use the Java...
4 Implement a Java program that meets the following requirements • You can use the Java standard sequence data structure API types for sets, lists, stack,queue and priority queue as needed. All are available in the java.util package, which you will want to import in your program. 1. Argue in code comments which data structure, stack or queue, you will use to implement this method. Implement a method which creates some String objects as food orders for a small restaurant,...
In this Java program you will implement your own doubly linked lists. Implement the following operations...
In this Java program you will implement your own doubly linked lists. Implement the following operations that Java7 LinkedLists have. 1. public DList() This creates the empty list 2. public void addFirst(String element) adds the element to the front of the list 3. public void addLast(String element) adds the element to the end of the list 4. public String getFirst() 5. public String getLast() 6. public String removeLast() removes & returns the last element of the list. 7. public String...
you will create a program with Java to implement a simplified version of RSA cryptosystems. To...
you will create a program with Java to implement a simplified version of RSA cryptosystems. To complete this project, you may follow the steps listed below (demonstrated in Java code) to guide yourself through the difficulties. Step I Key-gen: distinguish a prime number (20 pts) The generation of RSA's public/private keys depends on finding two large prime numbers, thus our program should be able to tell if a given number is a prime number or not. For simplicity, we define...
Write a program in Java Design and implement simple matrix manipulation techniques program in java. Project...
Write a program in Java Design and implement simple matrix manipulation techniques program in java. Project Details: Your program should use 2D arrays to implement simple matrix operations. Your program should do the following: • Read the number of rows and columns of a matrix M1 from the user. Use an input validation loop to make sure the values are greater than 0. • Read the elements of M1 in row major order • Print M1 to the console; make...
Java program In this assignment you are required to create a text parser in Java/C++. Given...
Java program In this assignment you are required to create a text parser in Java/C++. Given a input text file you need to parse it and answer a set of frequency related questions. Technical Requirement of Solution: You are required to do this ab initio (bare-bones from scratch). This means, your solution cannot use any library methods in Java except the ones listed below (or equivalent library functions in C++). String.split() and other String operations can be used wherever required....
This program focuses on programming with Java Collections classes. You will implement a module that finds...
This program focuses on programming with Java Collections classes. You will implement a module that finds a simplified Levenshtein distance between two words represented by strings. Your program will need support files LevenDistanceFinder.Java, dictionary.txt, while you will be implementing your code in the LevenDistanceFinder.java file. INSTRUCTIONS The Levenshtein distance, named for it's creator Vladimir Levenshtein, is a measure of the distance between two words. The edit distance between two strings is the minimum number of operations that are needed to...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT