for the primes
In this lab you will complete two applications that use the Abstract Data Type (ADT) list.
Chapter 12: Lists
docs.oracle.com/javase/8/docs/api/ —API documentation for the Java List interface
In javadoc directory
• ListInterface.html—Interface documentation for the interface ListInterface
The ADT list is one of the basic tools for use in developing software applications. It is an ordered collection of
objects that can be accessed based on their position. Before continuing the lab you should review the material
in Chapter 12. In particular, review the documentation of the interface ListInterface.java. While not all
of the methods will be used in our applications, most of them will.
The first application you will complete implements a child's selection game. In the standard version of this
game, a group of children gather in a circle and begin a rhyme. (One such rhyme goes “Engine, engine number
nine, going down Chicago line. If the train should jump the track, will you get your money back? My mother
told me to pick the very best one and you are not it.”) Each word in the rhyme is chanted in turn by one person
in the circle. The last person is out of the game and the rhyme is restarted from the next person. Eventually,
one person is left and he or she is the lucky individual that has been selected. This application will read the
number of players in the game and the rhyme from the keyboard. The final output will be the number of the
selected person. You will use two lists in this application. The first will be a list of numbers representing the
players in the game. The second will be a list of words in the rhyme.
The second application is one that computes prime numbers using the Sieve of Eratosthenes.
Suppose we have six players named 1, 2, 3, 4, 5, and 6. Further, suppose the rhyme has three words A, B, C.
There will be five rounds played with one player eliminated in each round. In the following table, fill in the
players next to the part of the rhyme they say in each round. Cross out the players as they are eliminated. The
first round has been completed for you.
Lab Manual for Data Structures and Abstractions with Java ™
Suppose we have five players named 1, 2, 3, 4, and 5. And the rhyme has six words A, B, C, D, E, F. There
will be four rounds played. In the following table, fill in the players next to the part of ...