The problem is that I do not know nothing yet about List. I instantiate five Student object, then instantiate a Course object called Biology and finally I want to add my first student to this previous Course object(Biology). I didn't create any constructor in my Student class, I think I can't do Student[0] = new Student(pass Biology as one of my parameters). Here is my Student and my Course class file:
public class Student
{
private string sfirstName;
private string slastName;
private DateTime sbirthdate;
private static int studentEnrolled;
private string courseAffected;
public string sFirstName
{
get
{
return sfirstName;
}
set
{
sfirstName = value;
}
}
public string sLastName
{
get
{
return slastName;
}
set
{
slastName = value;
}
}
public DateTime sBirthdate
{
get
{
return sbirthdate;
}
set
{
sbirthdate = value;
}
}
public static int StudentEnrolled
{
get
{
return studentEnrolled;
}
set
{
studentEnrolled = 0;
}
}
public string CourseAffected
{
get
{
return CourseAffected;
}
set
{
CourseAffected;
}
}
}
public class Course
{
private string courseName;
public string CourseName
{
get
{
return courseName;
}
set
{
courseName = value;
}
}
}
No comments:
Post a Comment