0% found this document useful (0 votes)
11 views3 pages

Asmt 2

The document outlines the functional requirements for a university management system, detailing three main classes: Person, Student, and Instructor, with their respective fields and methods. The Person class serves as a base class, while Student and Instructor inherit from it, adding specific functionalities related to course enrollment and teaching. Additionally, a Course class is defined to represent courses and manage instructor assignments, with example runs demonstrating the system's usage.

Uploaded by

zhiyenbetovadil
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)
11 views3 pages

Asmt 2

The document outlines the functional requirements for a university management system, detailing three main classes: Person, Student, and Instructor, with their respective fields and methods. The Person class serves as a base class, while Student and Instructor inherit from it, adding specific functionalities related to course enrollment and teaching. Additionally, a Course class is defined to represent courses and manage instructor assignments, with example runs demonstrating the system's usage.

Uploaded by

zhiyenbetovadil
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

Functional Requirements

1. Class: Person (Base Class)

A general class that stores common details of students and instructors.

Fields:

 String name
 int age

Methods:

 void displayInfo() → Prints name and age.

2. Class: Student (Inherits Person)

A class that inherits from Person and has additional features.

Fields:

 String studentId
 ArrayList<Course> enrolledCourses → Stores enrolled courses.

Methods:

✅ void enrollInCourse(Course course)

 Adds a course to the enrolledCourses list.

✅ void displayEnrolledCourses()

 Prints the courses the student is enrolled in.

✅ Override displayInfo()

 Displays the student's details and enrolled courses.

3. Class: Instructor (Inherits Person)

A class that inherits from Person and can teach courses.

Fields:

 String instructorId
 ArrayList<Course> assignedCourses → Stores courses the instructor teaches.

Methods:
✅ void assignCourse(Course course)

 Adds a course to the assignedCourses list.

✅ void displayAssignedCourses()

 Prints the courses the instructor is teaching.

✅ Override displayInfo()

 Displays the instructor's details and assigned courses.

4. Class: Course

A class to represent a course in the university.

Fields:

 String courseId
 String courseName
 Instructor instructor (assigned instructor, can be null)

Methods:

✅ void assignInstructor(Instructor instructor)

 Assigns an instructor to the course.

✅ void displayCourseInfo()

 Displays the course details.

Example Run (User Input in Bold)


Creating students and instructors...

Student enrolled: Alice in CS101

Student enrolled: Bob in CS101

Instructor assigned: Dr. Smith to CS101

Student Info:

Name: Alice

Age: 20

Student ID: S101


Enrolled Courses: CS101 - Introduction to Programming

Instructor Info:

Name: Dr. Smith

Age: 45

Instructor ID: I001

Assigned Courses: CS101 - Introduction to Programming

You might also like