How to create a class named integerset

Assignment Help Computer Engineering
Reference no: EM1330984

To Whom It May Concern:

I need a solution (2 .java files) for the following question. The solution is not to be in the form of an applet. Rather it is to be just .java files. The deadline for this solution is Monday May 5, 2003 at 12:00 Noon.

The first .java file will be named IntegerSet and will incorporate these characteristics:

Create a class named IntegerSet. Each object of the class can hold integers in the range 0 through 100.

A set is represented internally as an array of Booleans. Array element a[i] is true if integer "i" is in the set. Array element a[j] is false if integer "j" is not in the set. The no-argument constructor initializes a set to the so-called "empty set" (i.e., a set whose array representation contains all "false" values).
Provide the folling constructors:
1. A default constructor that initializes a set to the "empty set" in which all Boolean values in the array are set to "false."
2. A second constructor that accepts an IntegerSet object as an argument and creates a new IntegerSet object that is a copy of the original object

Provide the following methods:

1. Method unionOfIntegerSets creates a third set which is the set-theoretic union of the two existing sets (i.e., an element of the third set's array is set to "true" if that element appears in either or both of the existing sets; otherwise, the element of the third set is set to "false).
2. Method intersectionOfIntegerSets creates a third set which is the set-theoretic intersection of the two existing sets i.e., an element of the third set's array is set to false if that element is "false" in either or both of the existing sets; otherwise the element of the third set is set to "true."
3. Method insertElement inserts a new integer "k" into a set (by setting a[k] to "true).
4. Method deleteElement deletes integer "m" (by setting a[m] to "false.
5. Method isEqualTo determines if two sets are equal.
6. Method toString prints all the elements in a set separated by commas.

The second .java file will be called AS7. This is the driver file that tests the above methods. This file must instantiate four IntegerSet objects. The first object is instantiated by calling the default constructor; the second object is instantiated by calling the second constructor. The first two objects are populated by inserting hard coded numbers using Method insertElement. That is, the values that are represented by the index numbers of the elements of the arrays are to be hard coded and added automatically.

The 3rd and 4th IntegerSet objects can be instantiated by calling the second default constructor. IntegerSet objects 3 and 4 are populated by calling Methods unionOfIntegerSets and Method intersectionOfIntegerSets.

Thus for population of all IntegerSet objects no user input is/can be required. Population is to be automatic.

The output
1. must show that the method calls to Class IntegerSet from Class AS7 work and that the respective methods work.
2. should be in the form of a JOptionPane,
3. should show the following text that appears in quotes, and
4. must use Method toString to print the elements in each set.

The output should be as follows:

"The first set is named firstArrayName and was created by calling the default constructor. It is an empty set.
FirstArrayName will represent this set of values: { value1, value2, value3,..., valuen }." (Note: that each value is followed by a "," except the last value).
"The first set is named firstArrayName has been populated and is no longer empty. It was populated using Method insertElement. After population, It represents this set of numbers: { value1, value2, value3, valuen }." (Note: that each number of the array is followed by a "," except the last value).

"The second array set is named secondArrayName and was created by calling the second constructor. It is an empty set.
SecondArrayName will represent this set of values: { value1, value2, value3,..., valuen }." (Again, note: that each value is followed by a "," except the last value).
"The second set is named secondArrayName is has been populated and is no longer empty It was populated using Method insertElement. After population, It represents this set of numbers: { value1, value2, value3,..., valuen }." (Again note: that each number of the array is followed by a "," except the last value).

"The thirdarray set is named thirdArrayName and was created by calling Method unionOfSets on the first two sets. It represents this set of numbers: { value1, value2, value3, valuen }." (Again note: that each number of the array is followed by a "," except the last value).

"The fourth array set is named fourthArrayName and was created by calling Method intersectionOfSets on the first two sets. It represents this set of numbers: { value1, value2, value3, valuen }." (Again note: that each number of the array is followed by a "," except the last value).

"After calling Method deleteElement firstArrayName is again an empty set and all : .

Feel free to call if you have any questions about this project.

Also, please respond to this email and confirm that you are accepting this project and will be able to complete by the above deadline.

Reference no: EM1330984

Questions Cloud

Convert the counterfeit questions to sincere questions : Change the counterfeit questions to sincere questions.
Elements of leadership in context of change : Review essential elements of leadership in the context of change.
Secure and non secure facilities : Please explain the difference between secure and non secure facilities giving examples of each.
The number receiving the bonus varies from year to year : As the number receiving the bonus vary from year to year due to the state of the economy.
How to create a class named integerset : A set is represented internally as an array of Booleans. Array element a[i] is true if integer "i" is in the set. Array element a[j] is false if integer "j" is not in the set. The no-argument constructor initializes a set to the so-called "empty s..
Competitive market portfolio : What are the considerations that you need to be aware of to remain competitive and Based on the research that you have done, can you compete in the market that you have chosen?
Working in a diverse organization : Explain benefits of working in a diverse organization.
Make sure to comprise a history of the company or industry : Make sure to comprise a history of the company or industry or the market in which it operates.
Show the relationship between budgeting and planning : Show the relationship between budgeting and planning and How are they related? What differences exist between the two?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Describe the object-oriented databases

Describe the database planning and development process. What steps are involved, and what tools may be appropriate or helpful.

  Program to calculate value of d=b squared-4ac

Provided that a method takes three parameters a, b, c, of type double, state some code, to be involved as a part of the method, which calculates whether the value of "b squared" – 4ac is negative. If negative, code prints out the message "no real sol..

  Show how to find out such a seating arrangement

Show how to find out such a seating arrangement and prove that no such seating plan is possible.

  Classify traditional grade school algorithms

Classify traditional grade school algorithms

  Drawbacks to ethernet, token ring, fddi, and wireless

drawbacks to Ethernet, Token Ring, FDDI, and wireless.

  Factors for building a server room

Explain the factors you must consider for each of the following given topics: Walls and doors, Access control

  How the company can decrease the threats

This solution explores security threats faced by a company when implementing a wireless network. In particular, this solution utilizes a case study to define the threats faced by the company and extrapolates on how the company can reduce the threa..

  How to maintain inventory data on resources stored

give an eLibrary system where patrons can search a database to retrieve either the location of an actual resource in the library or an electronic copy of the source.

  Designing the class diagram

Instructors are allocated to one (or more) departments. One instructor also serves a department chair. Design a detailed class diagram in order to represent the above information.

  Purpose of testing

Describe the purpose of testing. Discuss how tests are carried out at different levels within the system.

  Determining the cpi of computer

A workstation utilizes a 15-MHZ processor with a claimed 10-MIPS rating to implement a provided programme mix. Suppose a one-cycle delay for every memory access. What is effective CPI of this computer?

  Write down a program that requests an integer

The Twelve Days of Christmas. Each year, PNC Advisors of Pittsburgh publishes a Christmas Price List. See Table 6.11. Write a program that requests integer from 1 through 12 and then lists the gifts for that day along with the day's cost.

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