Last active
May 13, 2022 15:58
-
-
Save oanabejenaru/3faf395bc3b5211750929617d5bf2305 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
val teachers = mutableListOf<Teacher>() | |
for (i in 0..2) { | |
teachers += Teacher("teacher $i", "teacher$i@faculty.ro") | |
} | |
val courses = mutableListOf<Course>() | |
for (i in 0..2) { | |
courses += Course("course $i", teachers[i], 2) | |
} | |
val students = mutableListOf<Student>() | |
for (i in 0..5) { | |
val student = Student("student $i", "student$i@faculty.ro", (i + 5).toDouble()) | |
student.setPreferredCourses(*courses.toTypedArray()) | |
students += student | |
} | |
val faculty = Faculty() | |
faculty.assignStudentsToCourses(students) | |
for (course in courses) { | |
println(course.name) | |
for (enrolledStudent in course.enrolledStudents) { | |
print("${enrolledStudent.name} ${enrolledStudent.grade} ||") | |
} | |
println() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment