- Nov 9, 2011
- 355
- 0
- 0
I'm on my final project for Java this quarter. I have finished it but there is extra credit I want to do. Here is my problem.
I am making a square class that is a child class of rectangle.
Rectangle has these fields in its constructor:
shapeId, redIn, greenIn, blueIn, lengthIn, widthIn
And square needs the same MINUS length, since all sides are the same.
I cannot use only width, since I'm inheriting from rectangle I need the length right? Because I will be inputing only 1 value for width. But, part of the extra credit is to only have the 5 constructor parameters. I'm not sure how to eliminate length.
any help or suggestions are appreciated.
I am making a square class that is a child class of rectangle.
Rectangle has these fields in its constructor:
shapeId, redIn, greenIn, blueIn, lengthIn, widthIn
And square needs the same MINUS length, since all sides are the same.
I cannot use only width, since I'm inheriting from rectangle I need the length right? Because I will be inputing only 1 value for width. But, part of the extra credit is to only have the 5 constructor parameters. I'm not sure how to eliminate length.
any help or suggestions are appreciated.