0% found this document useful (0 votes)
4 views

2 (3)g

The document outlines a School Management System that includes classes for School, Student, and Teacher, detailing their attributes and methods. It describes the aggregation relationship where a School can have multiple Students, while Teachers are associated but can exist independently. Additionally, it explains a Many-to-Many Association between Students and Courses, allowing students to enroll in multiple courses and vice versa.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

2 (3)g

The document outlines a School Management System that includes classes for School, Student, and Teacher, detailing their attributes and methods. It describes the aggregation relationship where a School can have multiple Students, while Teachers are associated but can exist independently. Additionally, it explains a Many-to-Many Association between Students and Courses, allowing students to enroll in multiple courses and vice versa.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Problem 1: School and Students Management System

Scenario:
Create a School Management System where a School has multiple Students and employs
multiple Teachers. However, a Student can exist independently of a School (e.g., if they
transfer).

Class Descriptions:
1. School
○ Attributes: schoolName, location
○ Methods: addStudent(), removeStudent(), hireTeacher(),
displayDetails()
2. Student (Aggregated by School)
○ Attributes: name, studentID, grade
○ Methods: getStudentDetails(), enrollInSubject()
3. Teacher (Associated with School, but independent)
○ Attributes: name, teacherID, subject
○ Methods: teach(), evaluateStudent()

Aggregation Relationship:
● School aggregates multiple Students (hollow diamond).
● School associates with multiple Teachers (not aggregation since a Teacher can work
elsewhere).
Problem 2: Association – Student and Course
Problem Statement:
A Student can enroll in multiple Courses, and a Course can have multiple Students. This is a
classic example of a Many-to-Many Association between Student and Course.

Explanation:
● In Association, two or more objects are related but can exist independently.
● Here, a Student can enroll in multiple Courses without being dependent on a single
course.
● Similarly, a Course can have multiple Students, but it still exists even if no students
enroll.

UML Diagram:
+-----------+ (enrolls in) +-----------+
| Student |-------------------------->| Course |
+-----------+ (has students) +-----------+
| |
| * * |
--------------------------------------
(Many-to-Many)

● The asterisk (*) represents a many-to-many relationship between Student and


Course.
● The relationship is bidirectional, meaning students can enroll in courses, and courses
can have students.

You might also like