summaryrefslogtreecommitdiff
path: root/assignments
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-02-17 12:11:32 -0700
committermo khan <mo.khan@gmail.com>2020-02-17 12:11:32 -0700
commitfa9eb62159b2fed0d320aab598b211af448d09cf (patch)
tree591c2821103bd32a22379bae95662a5d25d94cfb /assignments
parent3faece6f29bc057bb823210e5eea29521e81ad26 (diff)
Work on question 6
Diffstat (limited to 'assignments')
-rw-r--r--assignments/3/README.md2
-rw-r--r--assignments/3/question-6.pngbin0 -> 48459 bytes
-rw-r--r--assignments/3/question-6.puml78
-rw-r--r--assignments/3/question-6.rb66
4 files changed, 146 insertions, 0 deletions
diff --git a/assignments/3/README.md b/assignments/3/README.md
index 080a1fe..e09cfbb 100644
--- a/assignments/3/README.md
+++ b/assignments/3/README.md
@@ -128,3 +128,5 @@ From the requirements for this database, the following information was collected
* The database also keeps track of the types of plane each pilot is authorized to fly, and the types of plane each employee is qualified to service.
**Draw an object-oriented diagram for the Edmonton International Airport database.**
+
+![coop-insurance](./question-6.png)
diff --git a/assignments/3/question-6.png b/assignments/3/question-6.png
new file mode 100644
index 0000000..d73d9eb
--- /dev/null
+++ b/assignments/3/question-6.png
Binary files differ
diff --git a/assignments/3/question-6.puml b/assignments/3/question-6.puml
new file mode 100644
index 0000000..51094a9
--- /dev/null
+++ b/assignments/3/question-6.puml
@@ -0,0 +1,78 @@
+@startuml
+Owner <|-- Person
+Owner <|-- Corporation
+Person <|-- Pilot
+Person <|-- Employee
+
+Hanger "1" --> "*" Airplane
+Owner "1" --> "*" Airplane
+Maintenance "1" -- "1" Airplane
+Maintenance "1" -- "1" Employee
+
+Employee "1" --> "*" Hanger
+Pilot "1" --> "*" Restriction
+Pilot "1" --> "*" Airplane : fly
+Employee "1" --> "*" Airplane : service
+
+class Airplane {
+ {field} id
+ {field} capacity
+ {field} modelNumber
+ {field} registrationNumber
+ {field} weight
+ + hanger : Hanger [1]
+ + owner : Owner [1]
+ + maintenances : Maintenance[*]
+}
+
+class Maintenance {
+ {field} id
+ {field} workCode
+ {field} startedAt
+ {field} endedAt
+ {method} Duration hours()
+ + employee : Employee [1]
+ + airplane : Airplane [1]
+}
+
+class Hanger {
+ {field} id
+ {field} number
+ {field} capacity
+ {field} location
+ {field} employee : Employee [1]
+}
+
+abstract class Owner {
+ {field} id
+ {field} name
+ {field} address
+ {field} telephoneNumber
+}
+
+abstract class Person {
+ {field} socialInsuranceNumber
+}
+
+class Pilot {
+ {field} licenseNumber
+ + restrictions : Restriction [*]
+ + canFly : Airplane [*]
+}
+
+class Employee {
+ {field} salary
+ {field} shift
+
+ {method} +canService() : Airplane [*]
+}
+
+class Corporation {
+}
+
+class Restriction {
+ + id
+ + description
+}
+
+@enduml
diff --git a/assignments/3/question-6.rb b/assignments/3/question-6.rb
new file mode 100644
index 0000000..779bc2d
--- /dev/null
+++ b/assignments/3/question-6.rb
@@ -0,0 +1,66 @@
+class Airplane
+ attribute :id
+ attribute :capacity, Integer
+ attribute :model_number, Integer
+ attribute :registration_number, Integer
+ attribute :weight, Integer
+ attribute :plane_type
+
+ belongs_to :hanger
+ belongs_to :owner
+ has_many :maintenances
+end
+
+class Maintenance
+ attribute :id
+ attribute :work_code, String
+ attribute :ended_at, DateTime
+ attribute :started_at, DateTime
+ belongs_to :airplane
+ belongs_to :employee
+
+ def hours
+ ended_at - started_at
+ end
+end
+
+class Hanger
+ attribute :id
+ attribute :capacity, Integer
+ attribute :location, String
+ attribute :number, Integer
+ belongs_to :employee
+end
+
+class Owner
+ attribute :id
+ attribute :name
+ attribute :address
+ attribute :telephone_number
+end
+
+class Person < Owner
+ attribute :social_insurance_number
+end
+
+class Pilot < Person
+ attribute :license_number
+ has_many :restrictions
+
+ def airplanes
+ end
+end
+
+class Employee < Person
+ attribute :salary, Float
+ attribute :shift, Integer
+ has_many :plane_types
+end
+
+class Corporation < Owner
+end
+
+class Restriction
+ attribute :id
+ attribute :description, String
+end