- Build a system for entering and displaying the allergies that patients may have.
- The allergy will have its own set of symptoms reactions. The allergy will also have a spectrum of severity which the clinician should be aware of, and allergies can be reported by the patient or by next of kin.
Please review my code and tell me how I can improve my object-oriented design.
class Allergy
attr_accessor :name, :reporter, :time_reported
attr_reader :symptoms
def initialize(name, reporter, time_reported=Time.now)
@name = name
@reporter = reporter
@symptoms = []
@time_reported = time_reported
end
def add_symptoms(symptom, severity)
symptom = Symptom.new(symptom, severity)
@symptoms.push(symptom)
end
end
class Symptom
attr_accessor :symptom, :severity
def initialize(symptom, severity)
@symptom = symptom
@severity = severity
end
end