Created
August 18, 2014 19:29
-
-
Save case-eee/79a6d1a41249aa9a39b7 to your computer and use it in GitHub Desktop.
hospital interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO | |
# add employee and patient ID numbers - in case two people with the same name are both employees or patients | |
# AUTH process | |
class Hospital | |
attr_reader :name, :location, :employees, :patients | |
def initialize(args) | |
@name = args[:name] | |
@location = args[:location] | |
@employees = [] | |
@patients = [] | |
end | |
def fire_employee(future_job_hunter) | |
@employees.delete_if do |person| | |
person.name == future_job_hunter | |
end | |
end | |
def add_patient(new_victim) | |
@patients << new_victim | |
end | |
def discharge_patient(healthy_person) | |
@patients.delete_if do |person| | |
person.name == healthy_person | |
end | |
end | |
end | |
class Patient | |
attr_reader :name, :age, :gender, :affliction | |
def initialize(args) | |
@name = args[:name] | |
@age = args[:age] | |
@gender = args[:gender] | |
@affliction = args[:affliction] | |
end | |
end | |
class Employee | |
attr_reader :name, :occupation | |
def initialize(args) | |
@name = args[:name] | |
@username = args[:username] | |
@password = args[:password] | |
# @occupation = args[:occupation] | |
end | |
end | |
class Admin < Employee | |
def add_employee(new_guy) | |
# if gets.chomp is doctor | |
# @employees << Doctor.new(new_guy) | |
@employees << Employee.new(new_guy) | |
end | |
end | |
class Doctor < Employee | |
def initialize(args) | |
super | |
@occupation = 'Doctor' | |
end | |
end | |
puts 'Enter username' | |
username = gets.chomp | |
puts 'Password:' | |
password = gets.chomp | |
# search all employees for matching username && password | |
# find Employee object that matches above | |
# check occupation (access level) | |
# depending on access level, display different options | |
# add_employee <name> <username> <password> <occupation> | |
sacred_heart = Hospital.new(name: "Sacret Heart",location: "Anytown, USA") | |
doctor = Employee.new(name: "Perry Cox", occupation: "Doctor") | |
janitor = Employee.new(name: "Glenn Matthews",occupation: "Janitor") | |
nurse = Employee.new(occupation: "Nurse", name: "Carla Espinosa") | |
patient = Patient.new(name: "Bill Watterson", age: "56", affliction: "apathy", gender: "male") | |
another_patient = Patient.new(name: "Charlie Sheen", age: "48", gender: "male", affliction: "winning") | |
sacred_heart.add_employee(doctor) | |
sacred_heart.add_employee(janitor) | |
sacred_heart.add_employee(nurse) | |
sacred_heart.add_patient(patient) | |
sacred_heart.add_patient(another_patient) | |
# p sacred_heart.employees | |
# p sacred_heart.patients | |
# p sacred_heart.fire_employee("Glenn Matthews") | |
# p sacred_heart.discharge_patient("Bill Watterson") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment