Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given this code: public class IteratorApp { private void PrintAll(MyIterator myIter){ //code for printing ONE array } } int[] aList = {2,3,4,5,6,7,8,9}; double[] dList =

Given this code:

public class IteratorApp {

private void PrintAll(MyIterator myIter){

//code for printing ONE array

}

}

int[] aList = {2,3,4,5,6,7,8,9};

double[] dList = {1.2,2.3,3.4,4.5,5.6,6.7,7.8};

String[] slist = {"What", "me","worry?"};

public void run() {

MyIntIterator myIter = new MyIntIterator(aList);

MyDoubleIterator myDIter = new MyDoubleIterator(dList);

MyStringIterator mySIter = new MyStringIterator(slist);

PrintAll(myIter);

PrintAll(myDIter);

PrintAll(mySIter);

}

}

create an iterator for each array. All three iterators must share the same base type (that is, polymorphic). All iterators must implement First, Next, IsDone and CurrentItem operations.

Should have the following: main class, IteratorApp class, Iterator interface, MyIntIterator class, MyDoubleIterator class, MyStringIterator class.

OUTPUT should look like:

2

3

4

5

6

7

8

9

1.2

2.3

3.4

4.5

5.6

6.7

7.8

What

me

worry?

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

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

More Books

Students also viewed these Databases questions

Question

=+How might these stem from country and regional cultures?

Answered: 1 week ago