Question: import java.util.Scanner; public class PoD { public static void main( String [] args ) { Scanner in = new Scanner( System.in ); Queue battingOrder =

 import java.util.Scanner; public class PoD { public static void main( String

[] args ) { Scanner in = new Scanner( System.in ); Queue

import java.util.Scanner;

public class PoD {

public static void main( String [] args ) { Scanner in = new Scanner( System.in );

Queue battingOrder = new Queue();

final int TEAM_SIZE = in.nextInt(); in.nextLine();

for (int i=0; i

for( int outs = 3; outs > 0; ) { String batter = battingOrder.remove(); if( in.next().equals( "out" ) ) { System.out.println( batter + " is out!" ); outs--; } else { System.out.println( batter + " is on base!" ); } battingOrder.add( batter ); }

in.close(); System.out.print("END OF OUTPUT"); } }

=================================================================

import java.util.LinkedList;

public class Queue {

// Create Linked list to hold the names of batters

// YOUR CODE HERE

// ==============

/**

* add Method: Adds a batter to the batting order (linked list)

* @param s string to add to the linked list

* @return void

*/

public void add(String s) {

// YOUR CODE HERE

// ==============

}

/**

* remove Method: Removes a batter from the batting order (linked list)

* @return String batter's name

*/

public String remove() {

// YOUR CODE HERE

// ==============

}

}

The following are details of the new remove method. All other input/output and processing of PoD java are handled for you You will implement a queue in Queue java. The PoD main file (PoD.java) does not need to be touched. PoD.java will instantiate a queue and read in the batting order Batters wil take a turn at bat. At bat, they will either hit or be out. Once the team has 3 outs, the batting order (and all output) ends. Based on what you create in your queue, we will run through the batting order. Play ball! Directions Implement a queue in Queue.java based on skeleton provided

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!