This is
clearly homework since "need to use if statement".
Clearly you need to get more familiar with C# syntax;
specifically the assignment and comparison operators.
public bool IsEnrolled()
{
if (CurrentEnrolledCourse == null)
{
return false;
}
else
{
return true;
}
}
Assuming the student is enrolled only if the CurrentEnrolledCourse isn't empty.
A better way (since "need to use if statement"):
public bool IsEnrolled()
{
if (CurrentEnrolledCourse == null)
return false;
return true;
}
The right way:
public bool IsEnrolled()
{
return !string.IsNullOrEmpty(CurrentEnrolledCourse);
}
(And it should be a "get-only"
property.)