(Solved) : Part1 Implement List Based Queue Class Write Linkedqueuejava Class Implements Queueinterfa Q26980406 . . .
Part1. Implement a List based Queue class. You will write theLinkedQueue.java class that implements QueueInterface.java. Notethat QueueInterface.java extends the Iterable interface., whichmeans that you have to provide an iterator for it, similar toAssignment 1. The LinkedQueue implementation should be a doublylink list based one, based on the doubly link list you developed inAssignement 1
Part2. Using your LinkedQueue class. You will use the newLinkedQueue class to solve the following problem. Suppose thatcertain airport has one runway. Each airplane takes landingTimeminutes to land and takeOffTime to take off, and that, on theaverage, planes arrive at random instants of time. (Delays make theassumption of randomness quite reasonable.) There are two types ofqueues: a queue of airplanes waiting to land, and a queue ofairplanes waiting to takeoff. Because it is more expensive to keepa plane airborne than have one waiting on the ground, we assumethat the airplanes in the landing queue have priority over those inthe takeoff queue. Write a program to simulate this airport’soperation. You might assume a simulated clock that advances infive-minute interval. For each tic, generate two random numbers. Ifthe first is less than landingRate, a “landing arrival” hasoccurred and is added to the landing queue; and if the second isless than takeOffRate, a “takeoff arrival” has occurred and isadded to takeoff queue. In addition to simulating how queue getformed, and how planes get the authorization to land/takeoff, youprogram should calculate the average queue length and the averagetime that an airplane spends in a queue. You may also investigatethe effect of varying arrival and departure rates to simulate theprime and slack times of day, or what happens if the amount of timeto land and takeoff is increased or decreased. These variableparameters should be arguments to the program, and not hard coded..You will need to use the LinkedQueue implementation you developedin part 1.
Here’s two given file :
public interface List{ /** * Adds item to the end of a list * * @param item */ public void addLast(T item); /** * Adds item to the start of a list * * @param item */ public void addFirst(T item); /** * Retrieves item from List * * @param position where 0 is the first position in the list * @return item – the item at the given position on the list * (or null if no item exists at that position) */ public T get (int position); /** * Prints list to screen */ public void print(); /** * Prints list backwards to screen */ public void printBackwards(); /** * Removes first item from List * * @param item * @return true if item was removed, false otherwise */ public boolean remove (T item); /** * Determines if the List is empty. * * @return True if the List is empty, False otherwise. */ public boolean isEmpty(); /** * Determines the number of items in the List * * @return int – The length of the list */ public int getLength();}————————————————————————-import java.util.NoSuchElementException;/** * * Generic interface for a FIFO queue. * * @param The type of Object that the queue will accept. * */public interface QueueInterface extends Iterable { /** * This method is called to determine if the queue is empty. * * @return Returns true if the queue is empty, otherwise it returns false. */ public boolean isEmpty(); /** * This method is called to obtain the count of elements in the list. * * @return Returns the numbers of elements that are currently in the queue. */ public int size(); /** * * Adds the specified element into the stack if it is possible to do so immediately without * violating capacity restrictions, otherwise, throwing an IllegalStateException * if no space is currently available or NullPointerException if the specified element is null. * * @param e The element to add. * * @throws IllegalStateException If the element cannot be added at this time due to capacity restrictions. * @throws NullPointerException If the specified element being added is null. * */ public void enqueue(E e) throws IllegalStateException, NullPointerException; /** * * Retrieves, but does not remove, the head of this queue. * * @return The element at the head of the queue or null if the queue is empty. * */ public E peek(); /** * * Retrieves and removes the element at the head of this queue. * * @return The element at the head of the queue or null if the queue is empty. * */ public E dequeue(); /** * * Retrieves and removes the element at the specified index. * * @param index The index of the element to be removed. * * @return The element at the specified index. * * @throws NoSuchElementException If the specified index is invalid. * */ public E dequeue(int index) throws NoSuchElementException; /** * * Removes all elements from the queue. * */ public void removeAll();}
——————————————————————————————-
if you need any file from assignment1, please let me know thankyou
Need answer fro both part 1 and 2, but if you only able toanswer one, pleas part 2
Thank you
Expert Answer
Answer to Part1 Implement List Based Queue Class Write Linkedqueuejava Class Implements Queueinterfa Q26980406 . . .
OR