0% found this document useful (0 votes)
1 views2 pages

Code 2

The document outlines a simple object-oriented structure for a university system, including departments, professors, courses, and students. It establishes relationships between these entities, such as professors teaching courses and advising students. The document also includes print statements to display information about students' courses and their respective professors and departments.
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)
1 views2 pages

Code 2

The document outlines a simple object-oriented structure for a university system, including departments, professors, courses, and students. It establishes relationships between these entities, such as professors teaching courses and advising students. The document also includes print statements to display information about students' courses and their respective professors and departments.
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/ 2

System.out.

println("******************");

Department department2 = new Department();


department2.name = "Computer Engineering";

Professor professor2 = new Professor();


professor2.name = "Ali Gül";
Professor professor3 = new Professor();
professor3.name = "Ayşe Kahraman";

Course course2 = new Course();


course2.name = "Algorithms";
Course course3 = new Course();
course3.name = "Numeric Analysis";

Student student2 = new Student();


student2.name = "Hasan Doğru";
Student student3 = new Student();
student3.name = "Ela Baştürk";

department2.head = professor2;
professor2.department = department2;

department2.head = professor3;
professor3.department = department2;

course2.department = department2;
department2.courses = new Course[100];
department2.courses[0] = course2;

course3.department = department2;
department2.courses = new Course[100];
department2.courses[1] = course3;

course2.teacher = professor2;
professor2.coursesGiven = new Course[6];
professor2.coursesGiven[0] = course2;

course3.teacher = professor3;
professor3.coursesGiven = new Course[4];
professor3.coursesGiven[0] = course3;

professor2.advisee = new Student[15];


professor2.advisee[0] = student2;
student2.advisor = professor2;
professor3.advisee = new Student[20];
professor3.advisee[0] = student3;
student3.advisor = professor3;

student2.coursesTaken = new Course[8];


student2.coursesTaken[0] = course2;

course2.students = new Student[100];


course2.students[0] = student2;

student3.coursesTaken = new Course[9];


student3.coursesTaken[0] = course3;

course3.students = new Student[100];


course3.students[0] = student3;

System.out.println("Name of student student2's


first course is " + student2.coursesTaken[0].name);
System.out.println("Name of student student2's
first course's professor is " +
student2.coursesTaken[0].teacher.name);
System.out.println("Name of student student2's
first course's professor's department is " +
student2.coursesTaken[0].teacher.department.name);

System.out.println("Name of student student3's


first course is " + student3.coursesTaken[0].name);
System.out.println("Name of student student3's
first course's professor is " +
student3.coursesTaken[0].teacher.name);
System.out.println("Name of student student3's
first course's professor's

You might also like