I need to create the classes Course
, Teacher
, Student
, etc. The assignment also asked to "encapsulate" the data.
The tricky part is that the Course
class should contain an array of 3 student objects, and I really don't know how to do that.
This is part of the code(s) I have.
//Creating a Teacher class
using System;
namespace Homework_5
{
class Teacher
{
private string _firstName;
public string FirstName
{
get { return _firstName; }
set { _firstName = value; }
}
private string _lastName;
public string LastName
{
get { return _lastName; }
set { _lastName = value; }
}
}
}
//Creating a Course class
using System;
namespace Homework_5
{
class Course
{
private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
private int _credits;
public int Credits
{
get { return _credits; }
set { _credits = value; }
}
private string _durationInWeeks;
public string DurationInWeeks
{
get { return _durationInWeeks; }
set { _durationInWeeks = value; }
}
//private Teacher array of 3. <--- I DON'T KNOW HOW TO DECLARE THIS
}
}
The three Teacher
objects are instantiated in main
, along with the Course
object. The Teacher
objects should be passed to the Course
object.