# C++ project using Linux environment

Bajet $30-100 USD

Due Monday, October 24, 2005 at 11:59pm

The focus of this project is on C++, especially pointers, dynamic memory management, and operator overloading.

You are going to implement two classes: tuple and set.

A tuple is a list of integers that has a particular order, so the tuple (1 2 3) is different from the tuple (2 3 1) since the elements are ordered differently. Duplicates are allowed, so (2 2 7) is a valid tuple. The elements of your tuples will be integers, so each tuple will be a sequence of ints. Since you don't know how many elements will be in a given tuple, you must use dynamic memory to implement the class (more on this later).

Your implementation of class tuple may include whatever data and function members you consider necessary, but you must include the following public members and overloaded operators. In the following list, t and u are tuples and k is an int.

1. The default constructor, which creates an empty tuple.

2. The copy constructor, which makes a deep copy.

3. The constructor tuple(int k), which creates the tuple (0 1 2 ... k-1).

4. The constructor tuple(int *p, int k), which makes a tuple with the k elements from array p.

5. The destructor.

6. The overloaded assignment operator =, which makes a deep copy.

7. The void function addelem(int k), which adds integer k to the end of the current tuple.

8. The boolean function delelem(int k), which deletes the first occurence of integer k from the current tuple, if it exists. If it exists, then return true, else return false.

9. The function size(), which returns the size of the tuple, as an integer.

10. The following boolean operators:

* t = u defined similarly.

* t == u defined similarly.

* t[k] returns the kth element of t if k is at least 0 and strictly smaller than the size of the tuple (so the entries in t are numbered starting from 0). If k is out of bounds, then report an error message and abort the program.

* The stream insertion and extraction operators write out and read in tuples. A tuple is formatted as follows: first an open parenthesis: ( followed by one or more spaces, then a space-separated list of integers (the number of spaces between ints can vary), then one or more spaces, then a close parenthesis: ).

Next you will define class set. In this project, a set is a collection of tuples. A set is defined as an unordered collection, so the sets {(1 2) (2 4 7)} and {(2 4 7) (1 2)} are identical. No duplicates are allowed, so {(1 2) (1 2) (6 4 9)} is not a valid set; instead it should be represented as {(1 2) (6 4 9)}.

As with tuple, your implementation of class set may include whatever data and function members you consider necessary, but you must include the following public members and overloaded operators. In the following list, r and s are sets, t is a tuple, and k is an int.

1. The default constructor, which creates an empty set.

2. The copy constructor, which makes a deep copy.

3. The constructor set(tuple t), which creates a set containing a single tuple t.

4. The constructor set(tuple *p, int k), which makes a set with the k tuples from array p.

5. The destructor.

6. The overloaded assignment operator =, which makes a deep copy.

7. The void function addtuple(tuple t), which adds tuple t to the current set.

8. The boolean function deltuple(tuple t), which deletes tuple t from the current set, if it exists. If it exists, then return true, else return false.

9. The function size(), which returns the size of the set, as an integer.

10. The following operators:

* r + s returns the union of sets r and s, which is the set of tuples that appear in r or s. Note that due to the definition of a set, you need to remove any duplicate tuples before returning the union. E.g. if r = { ( 1 2 ) ( 9 4 3 ) } and s = { ( 6 8 1 ) ( 9 4 3 ) ( 15 ) }, then r + s = { ( 1 2 ) ( 9 4 3 ) ( 15 ) }.

* r * s returns the intersection of sets r and s, which is the set of tuples that appear in r and s. E.g. if r = { ( 1 2 ) ( 9 4 3 ) } and s = { ( 6 8 1 ) ( 9 4 3 ) ( 15 ) }, then r * s = { ( 9 4 3 ) }.

* r - s returns the set difference of sets r and s, which is the set of tuples that appear in r but not in s. E.g. if r = { ( 1 2 ) ( 9 4 3 ) } and s = { ( 6 8 1 ) ( 9 4 3 ) ( 15 ) }, then r - s = { ( 1 2 ) }.

* r^s returns the symmetric difference of sets r and s, which is the set of tuples that appear in r or s, but not both. I.e. it's the same as (r - s) + (s - r). It's also the same as (r + s) - (r * s). E.g. if r = { ( 1 2 ) ( 9 4 3 ) } and s = { ( 6 8 1 ) ( 9 4 3 ) ( 15 ) }, then r^s = { ( 1 2 ) ( 6 8 1 ) ( 15 ) }.

* r / s returns the Cartesian product of sets r and s, which means that you combine each tuple in r with each tuple in s. For example, if r = {(1 2 3) (4 5)} and s = {(6 7 8) (9) (10 11)}, then

r / s = {(1 2 3 6 7 8) (1 2 3 9) (1 2 3 10 11) (4 5 6 7 8) (4 5 9) (4 5 10 11)}

* r^k returns the Cartesian product of r with itself k times. For example, if r = {(1 2 3) (4 5)} then

r^3 = (r / r) / r = {(1 2 3 1 2 3) (1 2 3 4 5) (4 5 1 2 3) (4 5 4 5)} / r

= {(1 2 3 1 2 3 1 2 3) (1 2 3 1 2 3 4 5) (1 2 3 4 5 1 2 3) (1 2 3 4 5 4 5) (4 5 1 2 3 1 2 3) (4 5 1 2 3 4 5) (4 5 4 5 1 2 3) (4 5 4 5 4 5)}

* r = s defined similarly.

* r == s returns true if r and s are exactly the same set of tuples.

* t % r returns true if tuple t is in set r and false otherwise.

* ! r returns true if set r is empty and false otherwise.

* r[k] returns the kth tuple (assuming the tuples are sorted) of r if k is at least 0 and strictly smaller than the size of the set (so the entries in t are numbered starting from 0). If k is out of bounds, then report an error message and abort the program.

* The stream insertion and extraction operators write out and read in sets. A set is formatted as follows: first an open curly brace: { followed by one or more spaces, then a space-separated list of tuples formatted as above (the number of spaces between tuples can vary), then one or more spaces, then a close curly brace: }, e.g.:

{ ( 2 5 7 ) ( 1 7 ) ( 7 1 ) }

Notes:

1. Since some of your methods will add and delete items from tuple and set objects, you will need to dynamically adjust the lengths of your arrays. You will do this as follows. Maintain two different notions of array size. The first is the number of items stored. Every time you do an insert or a delete, this value will change. The second notion of size is the amount of memory you currently have allocated for your array. This value (we'll refer to it as SIZE) should be initialized to 4, and doubled each time you run out of room. If the number of entries stored in the array drops below SIZE/4, then you should cut SIZE in half.

2. It will be much easier (but not required) if you keep the tuples of each set sorted. This has obvious implications for methods addtuple and deltuple. But also note that since the overloaded array indexing operator allows the user to change arbitrary tuples in a set, then you may not always be able to count on a set being sorted when other operators are called. You must address this.

This project will be evaluated focussing upon the following criteria:

* Correctness: A software system that works as specified. You will need to turn in set.h and tuple.h (with your class definitions and documentation), [url removed, login to view] and [url removed, login to view] (with your implementations), the file you used to test your code, your test input files, and your makefile. (30% weightage in evalution)

* Style and Documentation: Code that is maintainable. This means that all classes used must be well-designed, functions used as appropriate, documentation and code organization that makes the code clear to the next person who will maintain the code. The interface needs to be fully specified, including preconditions and postconditions of every method.

The system should be written and should work on a UNIX platform, make sure your code is readable in a simple text editor like vi or emacs. In particular, do not let lines of text wrap (make them 80 characters or less in general) and use several spaces (e.g. 4) instead of tabs to indent, since the tab character is interpreted differently in different editors. (30% weightage in evaluation)

* Analysis: Give clear and complete answers to the following questions. (40% weightage in evaluation)

1. Is your system fully implemented and working properly? If not, explain.

2. How sure are you that your system is error-free? Justify.

3. Were the system requirements clear, or were clarifications needed? How do you suppose this compares with reality?

4. Did you thoroughly test your system? How about each class? How? Be somewhat specific (more than a sentence, less than a page). You should consider the class notes on software testing and Bughunt for this part.

5. Is code documentation necessary? Explain.

6. Is style (good use of variable names, using functions, spacing, indenting, etc.) important? Explain.

7. What is the time complexity of each of your functions?

8. How many hours did you spend on this assignment?

## Dianugerahkan kepada:

## 15 pekerja bebas membida secara purata $82 untuk pekerjaan ini

Hi There, I am an expert in C/C++ in Linux/Unix Environment. Can do it for you. Actually I have something of the sort already with me. Need to make some minor changes to made it work exactly the way u want.

Hi! I am happy to see your task. I will do it for you within the stipulated time if you agreed to my quote. Jagannadh

hi, we are a team of four highly skilled and experienced C++ programmers and we think we can help you get high grades on this project

Daedalus Technologies is a small business providing engineering services to the flight simulation and training community since 1990. Our services include Software Developement, Maintainance & Services, Website Design, Lagi

We are a growing s/w proffessionals working progressively towards fast & efficient solution provider.......& reliability & efficiency is our theme.

Im experienced in C/C++ and VC++ on both Windows and Linux. I can get this done in 2 days. Waiting for your response.... Thanks.