Question: write a set (setter) function for the height that will ensure that it is not set negative. class Dimension { private double height; private double
write a set (setter) function for the height that will ensure that it is not set negative. class Dimension { private double height; private double width; private double length; } abstract class Toy { private Dimension dimensions; private double weight; public String getType() { return "Toy"; } abstract public void play(); } 2.Write a default constructor for the Dimension class (above) that will set width, height, and length equal to 0.
3. Override the toString function for Dimension that will return a String containing the height, width, and length of a Dimension object, each with three digits after the decimal place.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
