Write and implement generic set class with attributes

Assignment Help Programming Languages
Reference no: EM1369844

1. Design and implement a generic Set class with attributes you find necessary and with the following methods. Set class has nonduplicate elements.

size : return the number of items in the set as an integer

clear : removes all of the items

add : adds the item passed as a parameter to the set if it is not already in the set. Returns the result of addition as a boolean value

contains : checks the Set for the item passed as the parameter, returns true if the item is in the set, false otherwise

isEmpty : returns true if there are no items in the set, false otherwise

remove : removes the item passed as the parameter if it is in the set and returns the result of removal as a boolean value

toArray : Returns the items in the Set as an array of the type of items in the set (e.g., if the Set object stores Strings, the returned array will be of type String)

toString : Displays all the items in the set

subSets : Returns all possible subsets of the Set excluding empty set, as a Set array of the same type.

join : Implements join operation on the current Set and the Set object of the same type passed as parameter and returns a NEW Set object that stores the result of the join operation.

intersect : Implements intersection operation on the current Set and the Set objects of the same type passed as parameter and returns a NEW Set object that stores the result of the intersection operation.

2. Demonstrate the capabilities of your classes. Be sure to provide at least two sets and use all of the methods in your class. You are free to use a text based or a graphical user interface.

Reference no: EM1369844

Questions Cloud

Information about present worth analysis : Two methods can be used for producing expansion anchors. Method A costs $80,000 initially and will have a $15,000 salvage value after 3 years.
Write program which reads in weight in pounds and ounces : Write the program which reads in the weight in pounds and ounces and putputs equivalent weight in kilograms and grams. Utilize at least three functions.
Equilibrium income and the price level in short run : The US is proposing a significant rise in duty on Canadian softlumber. USE APPROPRIATE DIAGRAMS to answer the questions about the Canadian economy.
Determining incremental analysis : Prepare an incremental analysis for the special order and should Pro Sports Inc. accept the special order? Explain your answer. What is the minimum selling price on the special order to produce net income of $4.10 per ball?
Write and implement generic set class with attributes : Write and implement the generic Set class with attributes you find essential and with the following methods. Set class has nonduplicate elements.
Comparing the three long run supply curves : Using diagrams for both industry and a representative firm, illustrate competitive long run equilibrium. Assuming constant costs, employ these diagrams to demonstrate
Critical thinking process : Explain a situation in which critical and creative thought could have been used for a better outcome and describe why it is important to think critically and creatively in similar situations.
Economics question on rate of return : Swagelok Enterprises is manufacturer of miniature fittings and valves. Over a 5-year period, the costs associated with one product line were given below:
Write algorithm to prompt for and accept four numbers : Write the algorithm which will prompt for and accept four numbers, sort them into ascending sequence and display them to screen. Your algorithm is to include module called Order _two_numbers.

Reviews

Write a Review

Programming Languages Questions & Answers

  Design fraction class to represent numerator and denominator

Design a fraction class. The class should have 2 data members to represent the numerator and denominator. Both of these numbers should obviously be integers.

  Write pseudocode for finding grade of a student

Write pseudocode for finding grade of a student given his/her total score. The program must display a grade of A if the score is above 85, a B if it is between 85 and 75, a C.

  Recursive method to search a string for a byrd

Write a recursive method that searches a string for a Byrd. A Byrd has the following properties. Its first character is an 'A'. If it is a two character Byrd then its second and last character is an 'H'.

  Scripting language programming in perl

course Scripting Language Programming,  Assignment   -  Perl,  ? Your coding style should conform to general Perl coding conventions. Your scripts should be clean, neat, and well-formatted (e.g. indention). Identifiers should also be properly name..

  Explaining box properties available in css

Browse the Web and choose a site that could benefit from box properties available in CSS. Make a screen capture of the page and indicate how you would change border and spacing properties.

  Compute and display total number of votes received

Display the table with appropriate labels for the rows and columns. Compute and display the total number of votes received by each candidate and the percentage of the total votes cast.

  Reducing the average memory access time

Suppose that increasing the line size to 128 bytes increases the H to 0.97. Does this reduce the average memory access time?

  Program using ten radio buttons to show five states

It is program using 10 Radio Buttons to show 5 States and 5 Capitals to user's interface. Also, there is text box to print "Correct" and "Incorrect" when Sate and the Capital is a correct match.

  Write program to accept five input values in array

Write a program that accepts five input values and stores them into an array. The program should display those five numbers in reverse order.

  Create application which permits user to input a price

Create an application which allows a user to input a price until suiatble sentinel value is entered. Output is a price of each item on each day,one through seven.

  Draw flowchart or write psuedocode to represent logic

Draw a flowchart or write psuedocode to represent the logic of a program that alllows the user to enter three values . The values rpesent hourly pay rate.

  Program to read from an input file

Write a program to read from an input file for 15 students, that contains each individual student ID, the course code, letter grade, and credit hours for five courses.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd