Question: Write java program with class name Rectangle. The class has two instance variables with name length and width of type double, one constructor with parameters

Write java program with class name Rectangle. The class has two instance variables with name length and width of type double, one constructor with parameters length and width (double data type). In case the value of length and width is less than 0 then set length and width to 0. In this class add method to find the area of rectangle (should returns the calculated area). Cuboid which extends Rectangle class. Declare one instance variables height of type double. all instance variables should be private. The class has one constructor with three parameters (height, width and length) of type double. The class should call superclass constructor. The constructor should initialize height parameter. In case height less than 0 set height to O value. The class should return the calculated volume. Note: volume of cuboid=length*width*height

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 Programming Questions!