Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Implement Queues / Linked List

Project Description:

In this project, two kinds of queue are implemented: LinkedQueue implements FIFOQueueInterface { .... } and LLQueueItr implements Iterable, FIFOQueueInterface { ... }. Note that FIFOQueueInterface should be described before the two queues are implemented.

Public interface FIFOQueueInterface

{

boolean isEmpty();

void enqueue(T item);

T dequeue();

}

Two queues should implement those three methods, isEmpty(), dequeue() and enqueue(). Both have inner class Node which has data and next with the constructor.

LinkedQueue.java will be defined as follows. The blanks should be filled.

Now, consider LLQueueItr.java. It implements both FIFOQueue and Iterable. The interface FIFOQueue is the same as described above, and the interface Iterable is givenby jdk (java.lang.Iterable). It turns out that LLQueueItr should implements all methods from the both interfaces. The method isEmpty(), enqueue() and dequeue() are defined same as in the class LinkedQueue. In addition to that, according to the API of Iterable, the method, iterator() should be implemented. The API says the method iterator() return an object of Iterator. Iterator is an interface in jdk (java.util.Iterator), and it has three methods, hasNext(), next() and remove(), which should also be implemented.

As a driver program invokes the method, iterator(), which returns an object in Iterator, it will use the returned object to invoke the methods of Iterator class. For example, hasNext() method is used to check if the next node of queue is available. If so, the method next() will return the content of that node and move to the next node. To make this possible, those methods should be implemented in the LLQueueItr class.

Skills required: Java

Java, Programming

  • Category:- Java
  • Reference No.:- M9593255

Have any Question?


Related Questions in Java

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Assessment instructionsin this assessment you will complete

Assessment Instructions In this assessment, you will complete the programming of two Java class methods in a console application that registers students for courses in a term of study. The application is written using th ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

Can someone kindly help me to consider whether java

Can someone kindly help me to consider whether Java provides the facility of operator overloading? If it does, may you kindly describe how overloading operators can be accomplished? If not, may you kindly describe why yo ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As