Class Diagram is the way to represent the relationship between the classes. In this article, we will see about the class diagram for the College Management system.
Classes :
- CollegeManagement – This class is the overall main class of the whole system.
- Department – This class contains the details of various departments in the college.
- Student – This class is for students and it is the base class for two child classes – UGStudent and PGStudent. Since UGStudent is a Student and PGStudent is a Student
- UGStudent – This class is the child class of Student and it contains the details of UGStudent.
- PGStudent – This class is the child class of Student and it contains the details of PGStudent.
- Staff – There are two types of staff in the college. So this class is the base class of two child classes – TeachingStaff and NonTeachingStaff
- TeachingStaff – This class is the child class of Staff. Since TeachingStaff is a Staff.
- NonTeachingStaff – This class is the child class of Staff. Since NonTeachingStaff is a Staff.
- Classroom – This class contains the details of each and every classroom in the whole college.
- Canteen – This class is for storing Canteen details inside the college
- Library – This class contains the details of a particular library in the college
- Bus – This class contains the details of a bus along with the bus driver details
- Hostel – Hostel can be of two types. So this class is the base class of two child classes – BoysHostel and GirlsHostel.
- BoysHostel – This class is the child class of the Hostel. Since BoysHostel is a Hostel.
- GirlsHostel – This class is the child class of the Hostel. Since GirlsHostel is a Hostel.
- Parking – This class contains the details of the parking area in a college. The parking area can be used by students, staff, visitors etc.
- Auditorium – Auditorium is a place where any events or guest lecture happens. This class contains the details of it.
Attributes :
- CollegeManagement – CollegeName, City, ContactNumber
- Department – DepartmentId, DepartmentName, HODName, TotalStaffs,TotalStudents
- Student – StudentId, StudentName, Gender, Year, ClassId
- Staff – StaffId, StaffName, DepartmentId, Salary
- Classroom – ClassId, Section, DepartmentId
- Canteen – InchargeId, ItemsList, AvailableList
- Library – LibraryId, LibrarianName, BookSection, TotalBooks
- Bus – BusId, BusNumber, DriverName, Destination, TotalSeats
- Hostel – StudentId, BlockNumber, RoomNumber
- Parking – SlotId, VehicleNumber, VehicleOwnerName
- Auditorium – AuditoriumName, EventsList, Date, Time, TotalSeats, DepartmentId
Methods :
1. CollegeManagement :
- Open() – This method tells whether the college is open or not.
- CollegeDetails() – This method contains the college details like name, its location and contact number.
2. Department :
- DepartmentDetails() – This method contains the department name and its corresponding Head of the department name, the total students count of each department.
- ShowEvents() – This method is to show any events in a particular department.
3. Student :
- StudentDetails() – This method contains all the information about each and every student in the college.
- PayFees() – This method contains the payment status of each student.
- IsPresent() – This method shows whether the student is present to the college on a particular date.
4. Staff :
- StaffDetails() – This method contains the details of both teaching as well as non-teaching staff along with their salary details.
5. Classroom :
- ClassroomDetails() – This method shows the details of each classroom and to which department the classroom belongs.
- IsOccupied() – This method tells whether the classroom is occupied or not
6. Canteen :
- ShowItems() – This method shows the items which are present in the canteen
- Buy() – This method is used to buy any item in the college canteen.
7. Library :
- LibraryDetails() – This method contains the details of the library inside the college
- SearchBooks() – This method is used to search any book in the library.
- LendBooks() – This method is to get the book from the library.
- ReturnBooks() – This method is used to contain the details of the returned book.
- PayFine() – This method contains the details to pay the fine.
8. Bus :
- BusDetails() – This method contains the details of buses like area details, bus name and the driver details.
- SeatsAvailability() – This method shows the details of available seats in a particular bus.
9. Hostel :
- HostelDetails() – This method contains the details of the hostel like the number of blocks, warden details, food details etc.
- CheckIn() – This method is to check whether the student is present at the hostel or not.
- CheckOut() – This method is to check whether the student is checked out from the hostel or not when they are in the outstation.
10. Parking :
- ParkVehicle() – This method is used to store the details of vehicles that are parked inside the college.
11. Auditorium:
- BookEvents() – This method is to book the auditorium for conducting the events.
Relationship :
1. Inheritance :
Inheritance is the practice of acquiring the required properties from one class to another class. The class which acquires the properties is known as the child class. The class which allows its properties to be acquired is known as the parent class. It is simply known as the Parent-child relationship. Ie. “Is-a” relationships
Here, the below classes follow inheritance
- Student – UGStudent and PGStudent
- Staff – TeachingStaff and NonTeachingStaff
- Hostel – BoysHostel and GirlsHostel
Student – UG Student and PG Student :
UG Student and PG student are child classes of students and UG is a student and PG student is a student.
Staff – Teaching staff and Non teaching staff :
Teaching staff and Non teaching staff are child classes of Staff. Teaching staff is a staff and Non-teaching staff is also a staff.
Hostel – BoysHostel and GirlsHostel :
BoysHostel and GirlsHostel are child classes of hostels. BoysHostel is a hostel and GirlsHostel is a hostel.
2. Aggregation :
In Aggregation, Class A and Class B are dependent on each other which indicates that A has an instance of B and B has an instance of B, but they are not physically contained inside each other. In simple terms, Class B can exist without Class A. It follows “has-a” relationship.
Here, the below classes follow aggregation,
- College management and hostel
- College management and parking.
They follow aggregation because the hostel and parking can exist without College.
3. Composition :
In composition, Class A and Class B are dependent on each other which indicates that class A has an instance of class B inside class A. In other words, class B is physically contained inside class A. So class B cannot exist without class A. It follows a “has-a” relationship.
Here,
- College management and department
- College management and auditorium
- College management and classroom
follows composition.
Because the department, auditorium and classroom cannot exist without college management and are physically composed inside the college management.
4. Association :
In Association, one class is not committed to the other class in any means, but both of the classes use each other and function in their own respective spaces. It follows the “using” relation.
Here,
- Student and staff
follow association because the student uses staff and the staff uses students
5. Unidirectional Association :
In unidirectional Association, two classes are related in some ways, but only one class makes use of the other class whereas the other class is not benefited from the relationship. Class A can call Class B whereas Class B cannot call Class A.
Here,
- Student and Classroom
- Student and Library
- Teachers and Library
- Student and Bus
- Student and Auditorium
- Student and Canteen
follows unidirectional association because the classroom , library, bus, auditorium and Canteen are being used by students whereas on the other hand classroom, library, bus, auditorium and Canteen are not benefited by the relationship with students. So they follow unidirectional association.
Notations :
Class Diagram :