Answered step by step
Verified Expert Solution
Link Copied!

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:
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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

Students also viewed these Databases questions

Question

Identify the motives that fuel prejudice.

Answered: 1 week ago

Question

I need help studying for my Operating System class

Answered: 1 week ago