Skip to content

Instantly share code, notes, and snippets.

@crazywolf132
Created April 9, 2019 00:11
Show Gist options
  • Save crazywolf132/eefd6ff994f2a9e9c724cce3864e84f2 to your computer and use it in GitHub Desktop.
Save crazywolf132/eefd6ff994f2a9e9c724cce3864e84f2 to your computer and use it in GitHub Desktop.
Task to learn java

Hospital

Your task today is to create a hospital management system. You only have to work with departments and patients.

What should happen.

Each department has to have the following:

  • Name
  • Capacity
  • List of patients
  • Teatment type

Each patient has to have the following:

  • First Name
  • Last Name
  • Treatment Level
  • Blood type

Before you can create any patients, you must have a department. The maximum capacity of each department is 6 (apart from the waiting room).

To add a patient to a department, it must meet a few requirements first.

  • The department must exist.
  • The department must have enough room left to add another patient.
  • The department must of equal or greater Treatment level. (more on this latter.)

Once those requirements are satisfied, you can add them to the department.

Treatment level.

Each departmnet must have a treatment level int. When adding people to the department, it will be used to see if the patient can be treated there or not.

If the treatment level of the department is not sufficiant, Your job is to create the patient and place them into a "waiting room".

Once there, you should recommend a department for them to go into based on their treatment level requirement and how many avaliable spots there are left.

Random variables.

Every time we run the menu, we are going to have an eventChecker() and eventCreator() function run.

Event Creator

The event creator must have a 20% chance of running and performing a random task inside of that. (50% chance of which function after the 20% of even running.) There are 2 tasks to run. Either create a new patient and add them to the waiting room, or randomly remove a patient from the hospital system.

These functions (eventChecker() and eventCreator()) should only be added to the main function, otherwise it will increase their likely hood of running.

Event Checker

Event checker should check to see how many patients dont actually have anywhere to go. (Are sitting in waiting room).

The system should not allow you to quit whilst there are people in the waiting room. Even if it means you need to create a new Department to handle all these people.

What you need.

Your main file should contain a list of all the departments, aswell as a list of all the Patients your hospital has currently.

Classes

These are the following classes you need

  • Patient
  • Department
  • Waiting room (sub-class of Department)

Functions

  • Main menu (can be in your main function)
  • Departmnet Menu
  • Patient Menu
  • Display
  • Load
  • Save
  • Event Checker
  • Event Creator
  • Event Fixer (for showing whats wrong with your hospital)

Example menus

MAIN MENU:

    *******************
       EVENT COUNT: 0
    *******************


    1 - Department Menu
    2 - Patient Menu
    3 - Display
    4 - Save

    5 - Quit

Department Menu:

    1 - Create Department
    2 - Delete Department

    3 - Back

Patient Menu:

    1 - Create Patient
    2 - Delete Patient
    3 - Re-assign Patient

    4 - Back

Display:

    [Department] Name: Emergency, Capacity: 4, Current amount: 3, Treatment Level: 3
        [Patient] Name: Brayden Moon, Blood Type: AB+, Treatment Level: 2

Save:

    Please wait...

Saving format (same as loading)

Here is the basic layout

    DEPARTMENT_NAME
    DEPARTMNET_TREATMENT_LEVEL
    DEPARTMENT_CAPACITY
    DEPARTMENT_COUNT (current people in it)
    PATIENT_FIRST_NAME
    PATIENT_LAST_NAME
    PATIENT_BLOOD_TYPE
    PATIENT_ID
    PATIENT_TREATMENT_LEVEL

Here is an example of a hospital with one Departmnet, and 2 patients in it.

    Emergency
    3
    4
    2
    Brayden
    Moon
    AB+
    0
    2
    Jessica
    Rizk
    O-
    1
    3

Requirements of the system

Everything is confidential, so... Every attribute inside the classes needs to remain private and just have get functions.

Waiting Room

The waiting room is a sub class of the Deparment class in the Hospital. It does not have a limit on the amount of people that can be in it.

It also shouldnt be added to the save file

The reason for this is, You cant save with anyone in the Waiting room, so that means you can leave it out when you save the hospital.

Waiting room is not like the other departments. The other departments need to be saved, when you save the hospital. Regardless of whether or not there are any Patients in that department.

Where can i get help?

... not me. Google. If you just cant get it after about 10 different attempts, let me know. I will give the class a hint.

@crazywolf132
Copy link
Author

REVIEW:

More functions needed.

  • Create Department

  • Delete Department

  • Find Department

  • Create Patient

  • Delete Patient

  • Find Patient

  • Relocate Patient

@crazywolf132
Copy link
Author

Review:

Patients also need an ID

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment