SOLUTION: shape s[] new shape[6]
s[0]=new shape("red");
s[1]=new shape("blue");
s[2]=new Rectangle(1,2,"yellow");
s[3]=new Rectangle(10,20,"red");
s[4]=new Box(2,3,4,"blue"
Algebra.Com
Question 1028888: shape s[] new shape[6]
s[0]=new shape("red");
s[1]=new shape("blue");
s[2]=new Rectangle(1,2,"yellow");
s[3]=new Rectangle(10,20,"red");
s[4]=new Box(2,3,4,"blue");
s[5]=new Box(20,30,40,"black");
for (int i=0; i
{if (s[i] instance of Box)
System.out.print((Box)s[i].volume());
if(s[i] instance of Rectangle&&!(s[i] instance of Box)
System.out.print((Rectangle)s[i].area());
if(s[i] instance of shape&&!(s[i] instance of Box)&&!
(s[i] instance of Rectangle))
System.out.print(s[i].get color()}
}
.
.
.
.
.
this is main class.
(i need the other class)
class shape?
class rectangle?
class box?
Answer by ikleyn(52855) (Show Source): You can put this solution on YOUR website!
.
Not for this site.
RELATED QUESTIONS
Shape:Rectangle
Area:16m^2
Make length 2m less than 3 times it's width
Find the length (answered by josgarithmetic,ikleyn)
An open document on your computer screen is shaped as a 5-inch square. If you increase... (answered by ewatrrr)
Solve the following problems applying the appropriate special right triangle theorem.
1. (answered by greenestamps,mananth)
112. Decreasing cube. Each of the three dimensions of a cube with sides of length s... (answered by scott8148)
112. Decreasing cube. Each of the three dimensions of a
cube with sides of length s... (answered by solver91311)
A square garden is to be enlarged to a rectangular by adding 5 ft. to the length and... (answered by ewatrrr)
Level 1, General Polynomials, Degree 2
Write your answer in the form (as + b) (cs +d) (answered by jim_thompson5910)
s/(s^4+s^2+1)
(answered by tommyt3rd)
A rectangle has dimensions of 60 by 40. The longer sides of the rectangle increase
by... (answered by ankor@dixie-net.com)