In: Computer Science
DUE IN TWO HOURS
ASAP PLEASE!!!
Given the following specification, design a class diagram using PlantUML. To design the class diagram, use abstract (10 points), static (10 points), package (20 points ), namespace (20 points ), association (20 points ), and generalization (20 points ) on PlantUML
Specification:
Submit a DOC/PDF file including PlantUML script and diagram.
ANSWER:
Class diagram describes the attributes and operations of a class and also the constraints imposed on the system. The class diagrams are widely used in the modeling of object oriented systems because they are the only UML diagrams, which can be mapped directly with object-oriented languages.
We can classify the above specifications into two
broader categories.
1. Defining members of school
2. Defining infrastructure of school.
We have defined these broader classification as different packages.
Memebrs and Infrastructure
Members:
We can have 3 types of person : Principal, Teachers, Students
(Generalisation)
Each person class have name and birthdate. These holds true for all
three specific types hence these are properties of
superclass.
However only Teacher and Principal have specific attribute -
salary.
Person can borrow books. (1 person can borrow many books and a
single book is borrowed under name of single person at a time hence
1:N association exists here)
Infrastructure:
Consists of:
- Books (that a person can borrow)
Have attributes title and abstract
Is also have methods - isAvailable that checks whether book is
available at that point of time
- borrow() and return() to perform borrow and return operation on
book.
- PlayGround (1 playground can have many swings depicts a 1 to many
association)
- Room (1 room can have many doors and desks 1:N association)
Rooms can be of 4 types : Office, Restroom, ClassRoom, Cafeteria
(Categories of room => Generalisation)
- Desk can have many rulers (1:N association)
Below is the code to generate required class diagram on PlantUML
@startuml
School "1" -down-> "1" Members.Principal
School "1" -down-> "N" Members.Student
School "1" -down-> "N" Members.Teacher
School "1" -down-> "N" Infrastructure.PlayGround
School "1" -down-> "N" Infrastructure.Room
package Members {
abstract class Person {
name
birthDate
}
class Teacher {
salary
}
class Principal {
salary
}
class Student
Person <|-- Teacher
Person <|-- Student
Person <|-- Principal
Person "1" - "N" Infrastructure.Books : borrow
}
package Infrastructure {
class Books {
title
abstract
isAvailable()
borrow()
return()
}
Playground "1" - "N" Swing : has
Room "1" -left-> "N" Chair : has
Room "1" -right-> "N" Door : has
Room <|-- office
Room <|-- RestRoom
Room <|-- ClassRoom
Room <|-- Cafeteria
ClassRoom "1" -left-> "N" Computer : has
ClassRoom "1" -right-> "N" Desk : has
Desk "1" -down-> "N" Ruler : has
}
( PLEASE VOTE FOR THIS ANSWER )
I THINK IT WILL BE USEFULL TO YOU ...............
PLZZZZ COMMENT IF YOU HAVE ANY PROBLEM I WIL TRY TO SOLVE IT ............
THANK YOU ........