Additional Notes on Set Functions
public set function such as
setCourseName should carefully scrutinize any attempt to modify the value of a data member (e.g.,
courseName) to ensure that the new value is appropriate for that data item. For example, an attempt to set the day of the month to 37 should be rejected, an attempt to set a person’s weight to zero or a negative value should be rejected, an attempt to set a grade on an exam to 185 (when the proper range is zero to 100) should be rejected, and so on.
Software Engineering Observation 3.3
Making data members private and controlling access, especially write access, to those data members ...