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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!