Question: public class Bed { private String name; protected String location; public String getName(){ return name; } public void setName(String name){ this.name=name; } public void getLocation(String

public class Bed { private String name; protected String location;

public String getName(){ return name; } public void setName(String name){ this.name=name; } public void getLocation(String location){ this.location=location; } public String setLocation(){ return location; } @Override public String toString(){ return name+": "+location; } }

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

public class CareFacility extends Company { String name; protected HourlyEmployee[] hourlyEmployee; protected ArrayStack patientStack; protected ArrayStack bedStack; public CareFacility(){ name=""; hourlyEmployee=new HourlyEmployee[10]; patientStack=new ArrayStack(); bedStack=new ArrayStack(); } public CareFacility(String name,HourlyEmployee[] hourlyEmployee){ this.name=name; this.hourlyEmployee=hourlyEmployee; } public void assignBed(){ } }

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

public class Patient { private String name; protected int priority; protected Bed bed;

public String getName(){ return name; } public void setName(String name){ this.name=name; } public int getPriority(){ return priority; } public void setPriority(int priority){ this.priority=priority; } public Bed getBed(){ return bed; } public void setBed(Bed bed){ this.bed=bed; } @Override public String toString(){ return name+": "+priority+"."+bed; } }

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

public interface StackADT { public void push(T element); public T pop(); public T peek(); public int size(); public boolean isEmpty(); @Override public String toString(); }

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

public class ArrayStack implements StackADT{ private static int DEFAULT_SIZE; private T[] stackArray; private int top;

public ArrayStack(){ DEFAULT_SIZE=100; top=0; stackArray=(T[])new Object[DEFAULT_SIZE]; } public ArrayStack(int initialSize){ stackArray=(T[])new Object[initialSize]; } private void expandCapacity(){ stackArray=Arrays.copyOf(stackArray,stackArray.length*2); } @Override public void push(T element) { if(size()==stackArray.length) expandCapacity(); top++; stackArray[top]=element; } @Override public T pop() throws EmptyCollectionException{ if(isEmpty()) throw new EmptyCollectionException("Empty stack: cannot pop"); T temp = stackArray[top]; stackArray[top]=null; top--; return temp; }

@Override public T peek()throws EmptyCollectionException{ if(isEmpty()) throw new EmptyCollectionException("Empty stack!"); return stackArray[top-1]; }

@Override public int size() { return top; } @Override public boolean isEmpty() { if(size()==0) return true; return false; } @Override public String toString(){ String result=" "; for(int i = 0;i

public class Bed { private String name; protected String location; public String

Lab 3: STACKS A Care facility provides bed and care for long-term care patients. When patients are registered, they are assigned beds, based on their criticality as well as bed availability. Patients that have the same level of critically, will be assigned bed on first come first served basis. Additionally, the care facility employs hourly employees. You have been tasked with creating a solution to help manage the facility. Below are some guidelines that need to be taken into consideration while creating a solution .Extend a CareFacility class from the Company class created in the previous lab . Create a bed class . Create a patient class . A patient is assigned a bed when there is availability When a patient is registered, he/she is assigned a priority between 1 and 10, depending on the criticality of his/her condition. After registration, a patient is assigned a bed based on availability and criticality, the most critical patient are given priority, as long as there are empty beds. If there are multiple patients that have the same criticality, bed assignment is based on first come first served o o o . The care facility employs hourly employees. . Implement an array based stack based in the specifications provided in the UML diagram below . Create a main class, containing a main method to run this progam . Proper documentation and unit testing should be applied to all artifact created OUTCOME: In the main method, add a set of patients and set of beds. The number of beds should be less than the number of patients Assign the available beds to patients, based on their criticality. Since, there are less beds than patients, some of the patients that are not critical will not be able to secure a bed . .Output the list of those patients that have been able to secure a bed and the bed name they have been assigned to. Lab 3: STACKS A Care facility provides bed and care for long-term care patients. When patients are registered, they are assigned beds, based on their criticality as well as bed availability. Patients that have the same level of critically, will be assigned bed on first come first served basis. Additionally, the care facility employs hourly employees. You have been tasked with creating a solution to help manage the facility. Below are some guidelines that need to be taken into consideration while creating a solution .Extend a CareFacility class from the Company class created in the previous lab . Create a bed class . Create a patient class . A patient is assigned a bed when there is availability When a patient is registered, he/she is assigned a priority between 1 and 10, depending on the criticality of his/her condition. After registration, a patient is assigned a bed based on availability and criticality, the most critical patient are given priority, as long as there are empty beds. If there are multiple patients that have the same criticality, bed assignment is based on first come first served o o o . The care facility employs hourly employees. . Implement an array based stack based in the specifications provided in the UML diagram below . Create a main class, containing a main method to run this progam . Proper documentation and unit testing should be applied to all artifact created OUTCOME: In the main method, add a set of patients and set of beds. The number of beds should be less than the number of patients Assign the available beds to patients, based on their criticality. Since, there are less beds than patients, some of the patients that are not critical will not be able to secure a bed . .Output the list of those patients that have been able to secure a bed and the bed name they have been assigned to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!