Square - length = len; width = len; } public void...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
public class Square extends Rectangle { p // fields int ID; // construcors Square () { System.out.println("doing Square constructor"); length = 8.0; width = 8.0; } Square (double val) { length = val; width = val; } // accessors public void setLength(double len) {
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: length = len; width = len; } public void setWidth(double wid) { width = wid; length = wid; } public double getDiagonal() { // new methods that is not in Rectangle return 0.0; } }...
View Full Document

Ask a homework question - tutors are online