Kotlinlearncs.online LogoJava
Return to List

Solve: Math Course Inheritance

Created By: Pranav Narayanan
/ Version: 2024.10.0

Write a class MathCourse which inherits from the existing class Course:

open class Course(val code: String?, val title: String?)

MathCourse should have an additional String field area, which is the branch of math that course pertains to. This value should be read-only. MathCourse's default constructor should accept parameters for the code, title, and area in that order.

MathCourse should also override toString() so that it returns a String of the format: "(code): (title) is in the (area) branch of math."

Related Lessons

Stuck? You may find these lessons helpful:

Report a Problem

Attribution must link to this page: https://www.learncs.online/solve/kotlin/math-course-inheritance/[email protected]