Question: java class inheritens Create class called box inherits from rectangle having the following: Private height geheight() . Default constructor and copy constructor to set Setdimension();


java class inheritens
Create class called box inherits from rectangle having the following: Private height geheight() . Default constructor and copy constructor to set Setdimension(); Area();//2*L*W +L* H+W* H Print(); public class box extends rectangle { private double height; } public double get_height() {return height;} public box() { height=0; } public box ( double w, double 1, double h) {super (w,1); height=h; public void setdimension (double w, double 1, double h) { setdimension( w, 1); // or super.setdimension( w, 1); height=h; } public void print () { super.print(); System.out.println("heigth= " + height); } public double area() { return 2 geti() *getw() +geti() *height+getw() *height; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
