Write a program that creates two instances of the generic class LinkedList given in Listing 12.12. The

Question:

Write a program that creates two instances of the generic class LinkedList given in Listing 12.12. The first instance is stadiumNames and will hold items of type String. The second instance is gameRevenue and will hold items of type Double. Within a loop, read data for the ball games played during a season. The data for a game consists of a stadium name and the amount of money made for that game. Add the game data to stadiumNames and gameRevenue. Since more than one game could be played at a particular stadium, stadiumNames might have duplicate entries. After reading the data for all of the games, read a stadium name and display the total amount of money made for all the games at that stadium.


1mport java.util.ArrayList; public class LinkedList2 { private List Node head; public LinkedList2( ) Constructor headings do not include the type parameter. { head = null; public void showList ( ) { ListNode position = head; while (position != null) { System.out.println(position.getData( )); position = position.getLink (); }

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: