Question: please I need linked data implementation in java not array You are given IBookPile interface and IBook interface. Implement the IBookPile interface using linked nodeas

please I need linked data implementation in java not array

You are given IBookPile interface and IBook interface. Implement the IBookPile interface using linked nodeas

You will need to write a Main class that test your implementation.

partial code is here.

public class Main { public static void main(String[] args) { IBook b1 = new Book("Java 1", "Joe"); IBook b2 = new Book("JavaFX 2", "Bill"); IBook b3 = new Book("Database", "Mike"); IBookPile pile = new BookPile(); pile.add(b1); pile.add(b2); pile.add(b3); for(int i=0; i

interface IBook { String getTitle(); }

class Book implements IBook { private String title; private String author; Book(String title, String author){ this.title = title; this.author = author; } public String getTitle(){ return title; } public String getAuthor(){ return author; } }

/** * A pile of very heavy books. A book is so heavy that * only one book can be placed on top of the pile one at a time * and only a book can be removed from the top of the pile one * at a time. No book can be removed */ interface IBookPile { /** * Place the book on top of the bile of books * @param book the book to be placed * @return Return true if successful. */ public boolean add(IBook book); /** * Remove the book from the top of the pile * @return book removed */ public IBook remove(); /** * Return the number of books in the pile * @return number of books in the pile */ public int size(); /** * Return the number of books that have the title. * @param title the title to search * @return number of books matching the title */ int count(String title); /** * Return the titles of all books in the pile * @return array of titles */ public String[] getTitles(); /** * Return the title of book at position start from bottom. * @param pos position of book * @return The title of the book */ public String getTitleAt(int pos); /** * Return true if pile of books contain such book. * @param title the title of the book. * @return True if there's a book with the title. */ public boolean contains(String title); }

class BookPile implements IBookPile {

public boolean add(IBook book){ throw new UnsupportedOperationException("To be implemented"); }

public IBook remove() { throw new UnsupportedOperationException("To be implemented"); }

public int size(){ throw new UnsupportedOperationException("To be implemented"); }

public int count(String title){ throw new UnsupportedOperationException("To be implemented"); } public String[] getTitles(){ throw new UnsupportedOperationException("To be implemented"); } public String getTitleAt(int pos){ throw new UnsupportedOperationException("To be implemented"); } public boolean contains(String title){ throw new UnsupportedOperationException("To be implemented"); } }

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!