diff options
| author | mo khan <mo.khan@gmail.com> | 2020-02-17 12:11:32 -0700 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-02-17 12:11:32 -0700 |
| commit | fa9eb62159b2fed0d320aab598b211af448d09cf (patch) | |
| tree | 591c2821103bd32a22379bae95662a5d25d94cfb | |
| parent | 3faece6f29bc057bb823210e5eea29521e81ad26 (diff) | |
Work on question 6
| -rw-r--r-- | Makefile | 32 | ||||
| -rw-r--r-- | assignments/3/README.md | 2 | ||||
| -rw-r--r-- | assignments/3/question-6.png | bin | 0 -> 48459 bytes | |||
| -rw-r--r-- | assignments/3/question-6.puml | 78 | ||||
| -rw-r--r-- | assignments/3/question-6.rb | 66 |
5 files changed, 170 insertions, 8 deletions
@@ -1,18 +1,34 @@ all : clean pdf -clean : - rm -f assignments/**/README.pdf +clean : clean1 clean2 clean3 -uml : - plantuml assignments/**/*.puml +clean1 : + rm -f assignments/1/README.pdf -pdf : assignments/1/README.pdf assignments/2/README.pdf assignments/3/README.pdf +clean2 : + rm -f assignments/2/README.pdf -assignments/1/README.pdf : +clean3 : + rm -f assignments/3/README.pdf + +uml : uml1 uml2 uml3 + +uml1 : + plantuml assignments/1/*.puml + +uml2 : + plantuml assignments/2/*.puml + +uml3 : + plantuml assignments/3/*.puml + +pdf : pdf1 pdf2 pdf3 + +pdf1 : cd assignments/1 && pandoc --metadata title="COMP-378: Assignment 1 - mo khan (3431709)" --from=commonmark --to=html5 -s -o README.pdf README.md -assignments/2/README.pdf : +pdf2 : cd assignments/2 && pandoc --metadata title="COMP-378: Assignment 2 - mo khan (3431709)" --from=commonmark --to=html5 -s -o README.pdf README.md -assignments/3/README.pdf : +pdf3 : cd assignments/3 && pandoc --metadata title="COMP-378: Assignment 3 - mo khan (3431709)" --from=commonmark --to=html5 -s -o README.pdf README.md 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.** + + diff --git a/assignments/3/question-6.png b/assignments/3/question-6.png Binary files differnew file mode 100644 index 0000000..d73d9eb --- /dev/null +++ b/assignments/3/question-6.png 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 |
