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

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 (); }1mport java.util.ArrayList; public class LinkedList2 { private List Node head; public LinkedList2() Constructor headings do not include the type parameter. { head =

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 (); }

Step by Step Solution

3.38 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

public class Revenue param args the command line arguments public static void mainString args Linke... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java An Introduction to Problem Solving and Progra Questions!