Question: java programming language Exercise Tail Function. The unix tail function takes two arguments, the name of a file and a non-negative integer, n. It then

 java programming language Exercise Tail Function. The unix tail function takes

java programming language

Exercise Tail Function. The unix tail function takes two arguments, the name of a file and a non-negative integer, n. It then opens and reads the specified file line by lne, printing the last n lines to the console. Your job is to provide a Java implementation of this function using your own implementation of a FixedCapacityQueue In a project named Fixed CapacityQueue, complete the definition of the following API for a LIFO queue: public class FixedCapacityQueue implements IterablecItem> FixedCapacityQueue (int capacity) // create empty queue with indicated capacity // add an item // remove/return the least recently added an item // is the quuefull? // is the queue empty? // number of items i the queue // front-to-back iterator void enqueue(Item item) Item dequeue) boolean isFul10 boolean isEmptyO int size() Iterator iterator As we have seen in the implementations for array based stacks and queues, must complete the definition of an appropriate class implemening Iterator so that the method iterator can initiate an object from this class. The main method of this queue class should test the definition by emulating the tail function. That is, it shuld take two command-line parameters, a string representing the name of a file, and a non-negative integer. It should open the specifed file, read le by lne, and finally print the last lines as specified. The lines that are read should be stored in a FixedCapacityQueue that is as small as possible to accomplish this task and the final lines should be printed using a foreach construction (which requires a functioning iterator)

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!