Write a public class MathCourse which inherits from the existing class Course:
public class Course {
private String code;
private String title;
public Course(String code, String title) {
this.code = code;
this.title = title;
}
//getters omitted
}
MathCourse should have an additional String field area, which is the branch of math that course
pertains to. Provide only a getter for area following the standard naming convention.
You should define a MathCourse constructor that accepts parameters for the code, title, and area
in that order. Reject null values for area.
MathCourse should also override toString() so that it returns a String of the format:
"(code): (title) is in the (area) branch of math."
You're challenge is to write tests for this problem described above.
Stuck? You may find these lessons helpful: