Introduction
Objective of this project was to create a UML (Unified Modeling Language) Class diagram for National Parks system. The following features had to be considered in implementation of the UML diagram:
- Multiple Parks
- Users
- Rangers per Park
- Visitors
- Lodges
- Tickets
- Annual Passes
Approach
The UML Class diagram defines various Classes, Class Attributes and Methods of the National Park system. Scotland's National Parks were used as a basis for the UML digram.
The UML Class diagram can be accessed via a Google Drive on draw.io: UML Class Diagram for National Park System
Implementation
A total of ten classes were defined within the UML Class diagram.
- National Park Management System Class
- National Park Class
- User Class
- Ranger Class
- Visitor Class
- Accommodation Class
- Attraction Class
- Animals Class
- Ticket Class
- Date Class
Each of the classes, its methods and attributes are described in more details in the next section.
UML classes
National Park Management System Class
A base class for multiple parks.
- National Park Management System Class Attributes: parks (list of parks)
- National Park Management System Class Methods: None
- National Park Management System Class Sub-classes: National Park
- National Park Management System Class Multiplicity:
- National Park Management System may have at least one National Park associated with it. One or more National Parks may be part of the National Park Management System
- National Park Management System Class Super-classes: None
National Park Class
A class for multiple parks.
- National Park Class Attributes: name, id, address, area, rangers (list of rangers)
- National Park Class Methods: None
- National Park Class Sub-classes: None
- National Park Associated Classes: Attraction, Accommodation, User, Visitor, Ranger, Ticket
- National Park Class Multiplicity:
- National Park may be associated with one or more Attractions
- National Park may be associated with zero or more Accommodation
- National Park may be associated with zero or more Users
- National Park may be associated with zero or more Visitor
- National Park may be associated with one or more Rangers
- At least one Ticket is needed to access a National Park
- National Park Class Super-classes: National Park Management System Class
User Class
A class for various Users of the National Park. It has two sub-classes: Ranger class and Visitor class.
- User Class Attributes: firstName, lastName, email, phone, userID, username, password
- User Class Methods: register(), login(), updatePassword(), editProfile()
- User Class Sub-classes: Ranger, Visitor
- User Associated Classes: National Park, Tickets (from Visitor Class)
- User Class Multiplicity:
- A User can be associated with zero or more National Parks
- User Class Super-classes: None
Ranger Class
A sub-class of User's Class.
- Ranger Class Attributes: rangerID, badgeNumber, parks (list of parks), salary
- Ranger Class Methods: None
- Ranger Class Sub-classes: None
- Ranger Associated Classes: National Park
- Ranger Class Multiplicity:
- A Ranger can be associated with one or more National Parks
- Ranger Class Super-classes: User
Visitor Class
A sub-class of User's Class.
- Visitor Class Attributes: parks (list of parks), tickets(list of tickets)
- Visitor Class Methods: deleteAccount()
- Visitor Class Sub-classes: None
- Visitor Associated Classes: National Park, Attraction, Ticket
- Visitor Class Multiplicity:
- A Visitor can be associated with zero or more National Parks
- A Visitor can have one or more Tickets
- A Visitor can visit one or more Attractions
- Visitor Class Super-classes: User
Accommodation Class
A class for various Accommodation in the National Park.
- Accommodation Class Attributes: accommodationID, name, type, park, addres, email, phone, capacity, facilities
- Accommodation Class Methods: checkAvailability(), book(), cancel()
- Accommodation Class Sub-classes: Lodge, Bed & Breakfast(B&B), Cottage
- Accommodation Associated Classes: National Park
- Accommodation Multiplicity:
- An Accommodation can be associated with zero or more National Parks
- Accommodation Class Super-classes: None
Attraction Class
A class for various Attractions in the National Park.
- Attraction Class Attributes: attractionID, name, description
- Attraction Class Methods: None
- Attraction Class Sub-classes: Lake, River, Forest Trail, Mountain, Village, Rheindeer Centre, Animals
- Attraction Associated Classes: National Park
- Attraction Multiplicity:
- Attraction can have zero or more Visitors
- An Attraction can be associated with one or more National Parks
- Rheindeer Centre cannot exist without at least one Rheindeer 🦌
- Attraction Class Super-classes: None
Animals Class
A class for various Animals in the National Park. A sub-class of Attraction's Class.
- Animals Class Attributes: type, name, age, gender, color, quantity
- Animals Class Methods: None
- Animals Class Sub-classes: Rheindeer, Sheep, Highland Cow
- Animals Associated Classes: None
- Animals Multiplicity: None
- Animals Class Super-classes: Attraction
Ticket Class
A Ticket Class is a Super-class for different types of tickets and has associations with other classes.
- Ticket Class Attributes: id, issueDate, expiryDate, visitor, parks
- Ticket Class Methods: choose(), add(), update(), buy(), cancel(), upgrade()
- Ticket Class Sub-classes/Inheritance: Annual Pass, Day Ticket, Weekend Ticket.
- Ticket Class Associated Classes: National Park, Visitor, Date.
- Ticket Class Multiplicity:
- A Ticket may be associated with zero or one Annual Pass. An Annual Pass may be associated with exactly one Ticket
- A Ticket may be associated with zero or one Day Pass. A Day Pass may be associated with exactly one Ticket
- A Ticket may be associated with zero or one Weekend Pass. A Weekend Pass may be associated with exactly one Ticket
- Ticket can have one issue date and one expiry date.
- A Ticket can be associated with one or more National Parks
- A Ticket may be associated with one or more Visitors
- Ticket Class Super-classes: None
Date Class
A class for different types of dates related to the Ticket.
- Date Class Attributes: day, month, year
- Date Class Methods: None
- Date Class Sub-classes: None
- Date Associated Classes: Ticket
- Date Class Multiplicity:
- The same Date can be reused for multiple tickets. Zero or more Dates can be associated with the Ticket
- Date Class Super-classes: None
