Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a complete bag class implementation using linked implementation. The linked bag class name must be LinkedBag and name your test program as LinkedBagDemo. Your

Write a complete bag class implementation using linked implementation. The linked bag class name must be LinkedBag and name your test program as LinkedBagDemo. Your test program should include following test conditions:

1. Get the number of items currently in the bag

2. See whether the bag is full

3. See whether the bag is empty

4. Add a given object to the bag

5. Remove an unspecified (not random) object from the bag

6. Remove an occurrence of a particular object from the bag, if possible

7. Remove all objects from the bag

8. Count the number of times a certain object occurs in the bag

9. Test whether the bag contains a particular object

10. Look at all objects that are in the bag

=============================================

Node.java

public class Node { private T entry; private Node next; private Node(T entryPortion) { this(entryPortion, null); } private Node(T entryPortion, Node nextNode) { entry = entryPortion; next = nextNode; } }

=======================================================

BagInterface.java

public interface BagInterface { public int getCurrentSize(); public boolean isFull(); public boolean isEmpty(); public boolean add(T newEntry); public T remove(); public boolean remove(T anEntry); public void clear(); public int getFrequencyOf(T anEntry); public boolean contains(T anEntry); public T[] toArray(); } // end BagInterface

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And SQL

Authors: Lucy Scott

3rd Edition

1087899699, 978-1087899695

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago