Thompson Rivers University
ImperialUnit – Subclass of MyBMI
Assignment 1 BMI - SM 2025This class extends MyBMI, which means it inherits the name and weight attributes as well as the getter/setter methods. Because MyBMI is abstract, this class must implement the abstract methods calculateBMI() and getAnalysis().
public class ImperialUnit extends MyBMI { }Add private attributes for height
This class stores height using two separate integer fields: one for feet and one for inches. Again we keep these private to follow encapsulation.
private int feet;
private int inches;Default and Parameterized Constructors
Members only
Keep reading this lesson
You've reached the end of the free preview. Unlock the rest of this lesson plus 54 more lessons in Thompson Rivers University.
- Unlimited coding questions
- Unlimited access to all classroom material
- Weekly live call for questions and guidance
- 3,000 AI tutor tokens / month
- Personal SQL database (3 MB)
- Progress tracking
Cancel any time.