Question: Suppose that the following declarations exist but the whole code is not shown: public class Shape implements Comparable public class Shapes implements Iterable Assume the

Suppose that the following declarations exist but the whole code is not shown: public class Shape implements Comparable
public class Shapes implements Iterable
Assume the following:
1. The compareTo method in Shape can appropriately compare two Shape instances.
2. The Shape class has an appropriate toString() method.
The main method inside Shapes is shown below with blanks that need to be filled in.
Shapes myShapes; // assume this is appropriately initialized in the code
Shape myshape; // assume this is appropriately initialized in the code
int count =0;
// get the iterator from myshapes
IteratormyShapeIterator=(blank)//blank1
//write a for-each loop to go over myShapes
For(blank)//blank 2
//if the shape inside myShapes is greater than myShape
if(blank) count++; // blank3
//iterator over every shape in the myShapeIterator
while(blank)//blank4
System.out.println(myShapeIterator.next());
FILL IN THE BLANKS
 Suppose that the following declarations exist but the whole code is

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