Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Urgent help needed in java ! Thanx Task : As you have learned in CSC 230 Discrete Structures, a set is a special bag that

Urgent help needed in java ! Thanx

Task :

As you have learned in CSC 230 Discrete Structures, a set is a special bag that does not allow repeated, or duplicate, entries. Please use the provided SetInterface to implement the following programs.

1. Define a classArraySet using an arraythat represents a set and implements the SetInterface. Make the ArraySet resizeable. Then write a program that adequately demonstrates your implementation.

2. Define a classLinkedSet using a linked list that represents a set and implements the SetInterface. Then write a program that adequately demonstrates your implementation.

3. Use the either ArraySet or LinkedSet to create a spell checker. The set serves as a dictionary and contains a collection of correctly spelled words, which can be read from an external file. To see whether a word is spelled correctly, you see whether it is contained in the dictionary. To simplify your task, restrict your dictionary to a manageable size.

Place the words whose spelling you want to check into a set, which can be read from another exteranl file. The difference (set difference) between the dictionary (the set containing the correctly spelled words) and the set of words to be checked is a set of incorrectly spelled words. Write a program that adequately demonstrates your implementation.

SetInterface.Java

/**

An interface that describes the operations of a set of objects.

*/

public interface SetInterface

{

/** Gets the current number of entries in this set.

@return The integer number of entries currently in the set. */

public int getCurrentSize();

/** Sees whether this set is empty.

@return True if the set is empty, or false if not. */

public boolean isEmpty();

/** Adds a new entry to this set, avoiding duplicates.

@param newEntry The object to be added as a new entry.

@return True if the addition is successful, or

false if the item already is in the set. */

public boolean add(T newEntry);

/** Removes a specific entry from this set, if possible.

@param anEntry The entry to be removed.

@return True if the removal was successful, or false if not. */

public boolean remove(T anEntry);

/** Removes one unspecified entry from this set, if possible.

@return Either the removed entry, if the removal

was successful, or null. */

public T remove();

/** Removes all entries from this set. */

public void clear();

/** Tests whether this set contains a given entry.

@param anEntry The entry to locate.

@return True if the set contains anEntry, or false if not. */

public boolean contains(T anEntry);

/** Retrieves all entries that are in this set.

@return A newly allocated array of all the entries in the set. */

public T[] toArray();

/** perform set union operation (A B) on this set(A) and a given set(B) .

@param set a given set.

@return the union of two sets ( no duplicates).

*/

public SetInterface union (SetInterface set);

/** perform set intersection operation (A B) on this set(A) and a given set(B) .

@param set a given set.

@return the intersection of two sets ( no duplicates).

*/

public SetInterface intersection (SetInterface set);

/** perform set difference operation(A - B) on this set(A) and a given set(B) .

@param set a given set.

@return the difference of two sets ( no duplicates).

*/

public SetInterface difference (SetInterface set);

} // end SetInterface

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

Seven NoSQL Databases In A Week Get Up And Running With The Fundamentals And Functionalities Of Seven Of The Most Popular NoSQL Databases

Authors: Aaron Ploetz ,Devram Kandhare ,Sudarshan Kadambi ,Xun Wu

1st Edition

1787288862, 978-1787288867

More Books

Students also viewed these Databases questions

Question

Summarize what can be done to encourage ethical communication.

Answered: 1 week ago

Question

=+designing international assignment C&B packages.

Answered: 1 week ago