Skip to content
Open

1 #14

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 80 additions & 1 deletion src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,85 @@
import java.lang.reflect.Constructor
fun main(args: Array<String>) {

// write your code here
var P1 = Professor("Ahmed","AA","12345",)
var S1 = Student("Raghad", "Mohammed","CS100")


}
class Course(){

var professorOfCourse = Professor()
var studentInCourse = Student()

var CourseName : String = "CS100"
var number_of_lectures : Int = 2
var students : Student = studentInCourse
var professor : Professor = professorOfCourse

constructor (CourseName : String,number_of_lectures : Int,studentInCourse : Student,professorOfCourse : Professor) :this()



fun numberOfStudents (studentInCourse : Student ,CourseName : String){

println(studentInCourse,CourseName)
}

//int numberOfStudents()

//boolean assignProfessor(Professor p) // assign professor to course. Course can have only one professor.
fun professorName(){

println("firstName:${firstName} lastName")

} // return professor full name


fun enroll() {


if (studentInCourse >= 20) {


} // assign student to this course. Student can’t be enrolled to a course if the course has 20 studens
}

string courseInfo() // return the course name number of lectures professor and students

}

class Professor(){

var Course1 = Course()

// var firstName : String = "Ahmed"
//var lastName: String = "AA"
//var telephone:String = "12345"
var courses: Course = Course1

constructor (firstName: String, lastName: String, telephone:String) : this()
constructor (firstName: String, lastName: String, telephone:String ,Course1 : Course ) : this()

fun fullName(firstName : String , lastName: String ){
println("firstName:${firstName} lastName")

}
}


class Student(){

var Course1 = Course()

//var firstName : String = "Raghad"
//var lastName: String = "Mohammed"
var courses: Course = Course1

constructor (firstName: String , lastName: String) : this()
constructor (firstName: String , lastName: String ,Course1: Course) : this()

fun fullName(firstName : String , lastName: String ){

println("firstName:${firstName} lastName")
}
}