Implementation and Usage for a Set Class - Project IV | CS 23021, Study Guides, Projects, Research of Computer Science

Material Type: Project; Class: CS I PROG/PROBLEM SOLVING; Subject: Computer Science; University: Kent State University; Term: Fall 2008;

Typology: Study Guides, Projects, Research

Pre 2010

Uploaded on 08/01/2009

koofers-user-nd1
koofers-user-nd1 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS23021 Computer Science I
Project #4
Due by by 11:59pm on Wednesday, December 10, 2008
In this project you are to provide the implementation and usage for a Set class. I have provided a head er
file, set.h, which contains the definition of this class. Yo u need to provide the implementation of the
member functions d eclared in this class definition. Place your imp lementation in set.cpp. You can add
other methods and attributes to the class definition if necessary. You also need to develop a program that
uses the class. Place this program in a file named useset.cpp. The program should ask the user to input
the members of the first set, then the members of the second set, then the operation to be carried out and
then print the resu lts and exit. You can assume tha t the set members are natural numbers (positive integers).
There are no more than MAX_SETSIZE (this is a constant defined in set.h) members in the set. Input
zero signifies the end of the set. Zero itself is not part of the set. The user may input the same number
multiple times. How ever, set members should be all distinct, so do include duplicate numbers in a se t . You
do not have to eith er keep the set m embers sorted or output them in order.
An example dialogue is as follows. User input is in bold
input set A: 2 3 4 5 6 25 4 4 0
input set B: 55 6 4 44 2 4 0
available operations
1. intersection
2. union
3. complement
choose operation : 1
set A: 2 3 4 5 6 25
set B: 55 6 4 44 2
intersection of sets A and B: 4 6 2
Submit the files in the subversion r epository in subdirectory Project4. The files needed for submission
are: set.h, set.cpp and useset.cpp

Partial preview of the text

Download Implementation and Usage for a Set Class - Project IV | CS 23021 and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

CS23021 Computer Science I

Project

Due by by 11:59pm on Wednesday, December 10, 2008

In this project you are to provide the implementation and usage for a Set class. I have provided a header file, set.h, which contains the definition of this class. You need to provide the implementation of the member functions declared in this class definition. Place your implementation in set.cpp. You can add other methods and attributes to the class definition if necessary. You also need to develop a program that uses the class. Place this program in a file named useset.cpp. The program should ask the user to input the members of the first set, then the members of the second set, then the operation to be carried out and then print the results and exit. You can assume that the set members are natural numbers (positive integers). There are no more than MAX_SETSIZE (this is a constant defined in set.h) members in the set. Input zero signifies the end of the set. Zero itself is not part of the set. The user may input the same number multiple times. However, set members should be all distinct, so do include duplicate numbers in a set. You do not have to either keep the set members sorted or output them in order. An example dialogue is as follows. User input is in bold input set A: 2 3 4 5 6 25 4 4 0 input set B: 55 6 4 44 2 4 0 available operations

  1. intersection
  2. union
  3. complement choose operation : 1 set A: 2 3 4 5 6 25 set B: 55 6 4 44 2 intersection of sets A and B: 4 6 2 Submit the files in the subversion repository in subdirectory Project4. The files needed for submission are: set.h, set.cpp and useset.cpp