Question

In: Computer Science

Given the following specification, design a class diagram using PlantUML. To design the class diagram, use...

Given the following specification, design a class diagram using PlantUML. To design the class diagram, use abstract, static, package, namespace, association, and generalization on PlantUML

Specification:

  • A school has a principal, many students, and many teachers. Each of these persons has a name, birth date, and may borrow and return books. The book class must contain a title, abstract, and when it is available. Teachers and the principal are both paid a salary.
  • A school has many playgrounds and rooms. A playground has many swings. Each room has many chairs and doors. Rooms include offices, restrooms, classrooms, and a cafeteria. Each classroom has many computers and desks. Each desk has many rulers.  

Solutions

Expert Solution

Answer:

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
}

The Class diagram describes the attributes and also operations of a class and constraints inflict on the system.

The class diagrams are extensively used in the modeling because they are the only UML diagrams, which can be mapped directly with object-oriented languages.

Given, specifications into two broader categories.
Defining both members of school and infrastructure of school.
We have defined these broader classification as different packages. Members and Infrastructure

Given, 3 types of person : Principal, Teachers, Many Students
Each person class have name and birthdate. These holds true for all three specific types hence these are properties of superclass.
The 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 ( Each of these persons has a name, birth date, and may borrow and return books)
Have attributes title and abstract ,
Desk can have many rulers (1:N association)
Methods – is Available that checks whether book is available at that point of time
borrow() and return() to perform borrow and return operation on book.
Play Ground (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, Class Room,


Related Solutions

DUE IN TWO HOURS ASAP PLEASE!!! Given the following specification, design a class diagram using PlantUML....
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: A school has a principal, many students, and many teachers. Each of these persons has a name, birthdate, and may borrow and return books. The book class must contain a title, abstract,...
Program Specification Design an inventory class that stores the following members: serialNum: An integer that holds...
Program Specification Design an inventory class that stores the following members: serialNum: An integer that holds a part's serial number. manufactDate: A member that holds the date the part was manufactured. lotNum: An integer that holds the part's lot number. The class should have appropriate setter and getter functions. Next, design a stack class that can hold objects of the class described above. If you wish, you may use the linked list from program 5 as a basis for designing...
Complete the following class UML design class diagram by filling in all the sections based on...
Complete the following class UML design class diagram by filling in all the sections based on the information given below.         The class name is Boat, and it is a concrete entity class. All three attributes are private strings with initial null values. The attribute boat identifier has the property of “key.” The other attributes are the manufacturer of the boat and the model of the boat. Provide at least two methods for this class. Class Name: Attribute Names: Method...
Design bcd adder diagram using 7486
Design bcd adder diagram using 7486
Given the following UML class diagram, implement the class as described by the model. Use your best judgement when implementing the code inside of each method.
In java Given the following UML class diagram, implement the class as described by the model. Use your best judgement when implementing the code inside of each method.+------------------------------+| Circle |+------------------------------+| - radius : double = 1.0 |+------------------------------+| + Circle(radius : double) || + getRadius() : double || + setRadius(radius : double) || + area() : double || + perimeter() : double |+------------------------------+The following information might also be useful:Formula for area of a circle with radius r:       A = πr^2Formula for...
(Using Date Class) The following UML Class Diagram describes the java Date class: java.util.Date +Date() +Date(elapseTime:...
(Using Date Class) The following UML Class Diagram describes the java Date class: java.util.Date +Date() +Date(elapseTime: long) +toString(): String +getTime(): long +setTime(elapseTime: long): void Constructs a Date object for the current time. Constructs a Date object for a given time in milliseconds elapsed since January 1, 1970, GMT. Returns a string representing the date and time. Returns the number of milliseconds since January 1, 1970, GMT. Sets a new elapse time in the object. The + sign indicates public modifer...
(Using Random Class) The following UML Class Diagram describes the java Random class: java.util.Random +Random() +Random(seed:...
(Using Random Class) The following UML Class Diagram describes the java Random class: java.util.Random +Random() +Random(seed: long) +nextInt(): int +nextInt(n: int): int +nextLong(): long +nextDouble(): double +nextFloat(): float +nextBoolean(): boolean Constructs a Random object with the current time as its seed. Constructs a Random object with a specified seed. Returns a random int value. Returns a random int value between 0 and n (exclusive). Returns a random long value. Returns a random double value between 0.0 and 1.0 (exclusive). Returns...
IN JAVA PLEASE, USE COMMENTS Following the example of Circle class, design a class named Rectangle...
IN JAVA PLEASE, USE COMMENTS Following the example of Circle class, design a class named Rectangle to represent a rectangle. The class contains: • Two double data fields named width and height that specify the width and height of the rectangle. The default values are 1 for both width and height. • A no-arg constructor that creates a default rectangle. • A constructor that creates a rectangle with specified width and height • A method name getWidth() return the value...
C++ The following is a specification of three classes: Class Vehicle:       Attributes:       Age, an...
C++ The following is a specification of three classes: Class Vehicle:       Attributes:       Age, an integer à The age of the vehicle       Price, a float à The price of the vehicle       Behaviors: Vehicle() à default constructor sets age=0, and price=0.0 setAge()   à Takes an integer parameter, returns nothing setPrice() à Takes a float parameter, returns nothing getAge()   à Takes no parameters, returns the vehicle’s age getPrice() à Takes no parameters, returns the vehicle’s price End Class Vehicle...
Write a java program using the information given Design a class named Pet, which should have...
Write a java program using the information given Design a class named Pet, which should have the following fields (i.e. instance variables):  name - The name field holds the name of a pet (a String type)  type - The type field holds the type of animal that a pet is (a String type). Example values are “Dog”, “Cat”, and “Bird”.  age - The age field holds the pet’s age (an int type) Include accessor methods (i.e. get...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT