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

  How to assign new value to element of array indexed by j

Write single statement which assigns a new value to element of array indexed by j . This new value must be equal to twice the value stored in next element of the array (i.e. element after the element indexed by j.

  Why small to medium sized firm implement pki solution

Why would a small to medium sized firm implement a PKI solution? What are the characteristics required in using a password that will provide security protection for a company?

  Program for insertion sort and selection sort algorithms

Write a program involving the insertion sort, merge sort and selection sort algorithms.

  Creating a security policy by gathering information

Suppose mantle of a security consultant. You are asked to visit a client and gather information to develop a security policy for them.

  Program to print total balances forward and total withdrawal

At the end of report, print total balances forward, total deposits, total interest earned, total withdrawals and total final account balances.

  Generate an object-oriented design for a system

Generate an object-oriented design for a system that keeps tracks of your CD and DVD collection. Identify each of the classes, associated data, and operations for the classes.

  Javascript for metric conversions

Write a javascript that will assist the user with metric conversions. Your program should allow the user to specify the names of the units as strings.

  Make confirmation page using xhtml portion of script

Use XHTML portion of the script to make confirmation page to be viewed by visitor. Confirmation page must display the text of email message.

  Program to inputs encrypted four-digit integer

Write separate program to inputs encrypted four-digit integer and decrypts it to form the original number. thanks in advance for ur help.

  Write a script to declares and sets variable

Write a script that declares and sets a variable thats equal to the total outstanding balance due. If that balance due is greater than $10,000.00.

  Write a class to accepts no parameters and returns no value

Write class named ParkingMeter containing:A method named tick that accepts no parameters and returns no value. tick decreases value of timeLeft by 1, but only if value of timeLeft is greater than 0.

  Deisgn child class that overrides parent method

Deisgn child class named Box, that contains additional data field named depth and a computeSurfaceArea() method that overrides the parent method appropriately for a three-dimensional box

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