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:
The compareTo method in Shape can appropriately compare two Shape instances.
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 ;
get the iterator from myshapes
IteratormyShapeIteratorblankblank
write a foreach loop to go over myShapes
Forblankblank
if the shape inside myShapes is greater than myShape
ifblank count; blank
iterator over every shape in the myShapeIterator
whileblankblank
System.out.printlnmyShapeIteratornext;
FILL IN THE BLANKS
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
