Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started