In this lab, you will write an interface for a list that contains different meth
ID: 3583256 • Letter: I
Question
In this lab, you will write an interface for a list that contains different methods than those contained in the ListInterface class from Chapter 12. With this kind of list, the user can only access the beginning or ending elements of a list, not any elements from the middle of the list. Specify this list in an interface called EntryWayListInterface<T>.
Note that you are only creating the interface; you are not implementing the methods.
Requirements
Your interface must:
compile (20 points)
contain these exact method headers:
boolean insertHead(T newEntry)
boolean insertTail(T newEntry)
T deleteHead() (returns the object that has been deleted)
T deleteTail() (returns the object that has been deleted)
void display()
int contains(T anEntry) (returns the position of the entry that was found)
boolean isEmpty()
boolean isFull()
use appropriate javadoc-style comments (80 points)
You can review the ListInterface.java file or the resources listed here for examples of javadoc-style comments
Include comments about the purpose of the interface.
Each method should have a javadoc-style comment describing:
what the method does
what the parameters are (if any)
what the method returns (if anything)
You should run a javadoc tool to test your comments. (In Eclipse, you can right-click on the project name, then select Export, Java, Javadoc.)
Submitting
Review the Assignment Submission and Grading Guidelines before submitting your lab. Because this lab contains a single file, you do not need to zip it for submission.
If submitting as a group, submit one assignment only through one group member's Insight account. Put the names of all group members in Java comments at the top of each Java file.
Extra Credit
Complete Chapter 1, Project 2 (20 points). Write an interface file to specify the book pile described in the textbook. Write javadoc-style comments to describe the interface and each method in the same way as described above for EntryWayListInterface. Your file should compile. You should have 5 methods, supporting the actions listed below. You need to determine what the method headers should be (i.e., determine the return type and parameters).
place a book on the pile
remove a book from the pile
see what book is on the top of the pile
determine if any books are in the pile
get rid of all the books in the pile (clear your desk!)
If you complete the required lab and the extra credit, zip both files together for submission.
Explanation / Answer
Interface
/**
*
* @author prmsh
*/
public interface EntryWayListInterface<T> {
public boolean insertHead(T newEntry); // inserting new element at start of the list
public boolean insertTail(T newEntry);// inserting new element at end of the list
public T deleteHead(); // returns the object that has to be deleted.
public T deleteTail(); // returns the object that is deleted at last list
public void display(); // diplay the contents of the list
public int contains(T anEntry); // returns the position of the entry that was found
public boolean isEmpty(); // checking list is empty or not
public boolean isFull(); //checking list is full or not
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.