Need help writing C++ programming assignment. Due by 700 am (central time) 8/2/2013

Please review files attached

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

e 1
s 2
A 2
p 1
c
p 3
E
f 1
k 1 1
K 2 1
r 3
i 1 11
p 1
i 2 22
p 2
i 3 11
p 3
a 1
e 2
E
f 33
f 11
m 1
M 2
s 1
A 2
p 1
A 3
p 1
A 1
p 1
k 1 1
k 1 11
p 1
K 2 2
K 2 22
p 2
x 3
p 3
i 3 33
p 3
X 3
p 3
x 1
p 1
X 1
p 1
i 1 1
i 1 2
i 1 3
i 1 4
i 1 5
p 1
i 2 7
i 2 5
i 2 2
i 2 0
p 2
i 3 5
i 3 5
i 3 5
i 3 5
i 3 5
p 3
a 1
E
f 1
f 3
f 5
f 7
k 1 1
p 1
k 1 5
p 1
k 1 3
p 1
A 3
p 1
f 5
s 1
m 1
M 1
i 1 2
i 1 2
p 1
x 1
p 1
X 1
p 1
A 2
p 1
A 3
p 1
K 1 5
p 1
r 1
A 2
p 1
p 2
p 3
E
r 2
r 3
E
r 1
i 1 7
i 1 1
i 1 9
i 1 5
i 1 3
p 1
i 2 4
i 2 8
i 2 0
i 2 2
i 2 6
p 2
A 3
p 1
a 1
A 2
p 1
a 1
e 1
m 1
M 1
s 1
x 1
p 1
X 1
p 1
r 1
A 2
p 1
i 1 5
i 1 5
i 1 1
i 1 8
i 1 1
p 1
x 1
p 1
X 1
p 1
a 1
p 2
k 2 2
p 2
k 2 6
p 2
p 1
c
p 3
q

e 1
s 2
A 2
p 1
c
p 3
E
f 1
k 1 1
K 2 1
r 3
i 1 11
p 1
i 2 22
p 2
i 3 11
p 3
a 1
e 2
E
f 33
f 11
m 1
M 2
s 1
A 2
p 1
A 3
p 1
A 1
p 1
k 1 1
k 1 11
p 1
K 2 2
K 2 22
p 2
x 3
p 3
i 3 33
p 3
X 3
p 3
x 1
p 1
X 1
p 1
i 1 1
i 1 2
i 1 3
i 1 4
i 1 5
p 1
i 2 7
i 2 5
i 2 2
i 2 0
p 2
i 3 5
i 3 5
i 3 5
i 3 5
i 3 5
p 3
a 1
E
f 1
f 3
f 5
f 7
k 1 1
p 1
k 1 5
p 1
k 1 3
p 1
A 3
p 1
f 5
s 1
m 1
M 1
i 1 2
i 1 2
p 1
x 1
p 1
X 1
p 1
A 2
p 1
A 3
p 1
K 1 5
p 1
r 1
A 2
p 1
p 2
p 3
E
r 2
r 3
E
r 1
i 1 7
i 1 1
i 1 9
i 1 5
i 1 3
p 1
i 2 4
i 2 8
i 2 0
i 2 2
i 2 6
p 2
A 3
p 1
a 1
A 2
p 1
a 1
e 1
m 1
M 1
s 1
x 1
p 1
X 1
p 1
r 1
A 2
p 1
i 1 5
i 1 5
i 1 1
i 1 8
i 1 1
p 1
x 1
p 1
X 1
p 1
a 1
p 2
k 2 2
p 2
k 2 6
p 2
p 1
c
p 3
q

// FILE: assign06.cpp
// An interactive test program for the SortedInt data type.
#include “SortedInt.h”
#include
#include
using namespace std;
// PROTOTYPES for functions used by this test program:
void print_menu();
// Pre: (none)
// Post: A menu of choices for this program is written to cout.
char get_user_command();
// Pre: (none)
// Post: The user is prompted to enter a one character command.
// The next character is read (skipping blanks and newline
// characters), and this character is returned.
int get_object_num();
// Pre: (none)
// Post: The user is prompted to enter either 1, 2 or 3. The
// prompt is repeated until a valid integer can be read
// and the integer’s value is either 1, 2 or 3. The valid
// integer read is returned. The input buffer is cleared
// of any extra input until and including the first
// newline character.
int get_integer();
// Pre: (none)
// Post: The user is prompted to enter an integer. The prompt
// is repeated until a valid integer can be read. The
// valid integer read is returned. The input buffer is
// cleared of any extra input until and including the
// first newline character.
void print_to_cout(SortedInt src);
// Pre: (none)
// Post: The content of src is displayed on cout.
/* Quiz: Why isn’t src passed by const reference? */
int main(int argc, char* argv[])
{
SortedInt s1, s2, s3; // 3 SortedInt’s to perform tests on
reset(s1); // initialize s1 to an empty SortedInt
reset(s2); // initialize s2 to an empty SortedInt
reset(s3); // initialize s3 to an empty SortedInt
int objectNum, // A number to indicate s1, s2 or s3
givenValue, // Holder for a user supplied value
delCount; // Counter for tracking items deleted
char choice; // A command character entered by the user
cout << "3 SortedInt objects (s1 s2 s3) have been created." << endl; cout << "Each is now empty." << endl; do { if (argc == 1) print_menu(); choice = get_user_command(); switch (choice) { case 'a': objectNum = get_object_num(); switch (objectNum) { case 1: if ( ! isEmpty(s1) ) cout << " Average for s1 is " << findAvg(s1) << endl; else cout << " s1 is empty (average undefined)" << endl; break; case 2: if ( ! isEmpty(s2) ) cout << " Average for s2 is " << findAvg(s2) << endl; else cout << " s2 is empty (average undefined)" << endl; break; case 3: if ( ! isEmpty(s3) ) cout << " Average for s3 is " << findAvg(s3) << endl; else cout << " s3 is empty (average undefined)" << endl; } break; case 'A': objectNum = get_object_num(); switch (objectNum) { case 1: add(s1, s1); cout << " s1 has been added to s1 " << endl; break; case 2: add(s1, s2); cout << " s2 has been added to s1 " << endl; break; case 3: add(s1, s3); cout << " s3 has been added to s1 " << endl; } break; case 'c': case 'C': s3 = combine(s1, s2); cout << " s3 has been set to the combination of s1 and s2" << endl; break; case 'e': objectNum = get_object_num(); switch (objectNum) { case 1: if ( isEmpty(s1) ) cout << " s1 is empty" << endl; else cout << " s1 is not empty" << endl; break; case 2: if ( isEmpty(s2) ) cout << " s2 is empty" << endl; else cout << " s2 is not empty" << endl; break; case 3: if ( isEmpty(s3) ) cout << " s3 is empty" << endl; else cout << " s3 is not empty" << endl; } break; case 'E': if ( equal(s1, s2) ) cout << " s1 is identical to s2" << endl; else cout << " s1 is not identical to s2" << endl; if ( equal(s1, s3) ) cout << " s1 is identical to s3" << endl; else cout << " s1 is not identical to s3" << endl; if ( equal(s2, s3) ) cout << " s2 is identical to s3" << endl; else cout << " s2 is not identical to s3" << endl; break; case 'f': case 'F': givenValue = get_integer(); cout << " The # of times " << givenValue << " occurs in s1 is " << findFreq(s1, givenValue) << endl; break; case 'i': case 'I': objectNum = get_object_num(); givenValue = get_integer(); switch (objectNum) { case 1: insert(s1, givenValue); cout << " " << givenValue << " has been inserted into s1" << endl; break; case 2: insert(s2, givenValue); cout << " " << givenValue << " has been inserted into s2" << endl; break; case 3: insert(s3, givenValue); cout << " " << givenValue << " has been inserted into s3" << endl; } break; case 'k': objectNum = get_object_num(); givenValue = get_integer(); switch (objectNum) { case 1: if ( delOne(s1, givenValue) ) cout << " " << givenValue << " has been deleted from s1" << endl; else cout << " " << givenValue << " not found in s1" << endl; break; case 2: if ( delOne(s2, givenValue) ) cout << " " << givenValue << " has been deleted from s2" << endl; else cout << " " << givenValue << " not found in s2" << endl; break; case 3: if ( delOne(s3, givenValue) ) cout << " " << givenValue << " has been deleted from s3" << endl; else cout << " " << givenValue << " not found in s3" << endl; } break; case 'K': objectNum = get_object_num(); givenValue = get_integer(); delCount = 0; switch (objectNum) { case 1: while ( delOne(s1, givenValue) ) ++delCount; cout << " " << delCount << " copies of " << givenValue << " has been deleted from s1" << endl; break; case 2: while ( delOne(s2, givenValue) ) ++delCount; cout << " " << delCount << " copies of " << givenValue << " has been deleted from s2" << endl; break; case 3: while ( delOne(s3, givenValue) ) ++delCount; cout << " " << delCount << " copies of " << givenValue << " has been deleted from s3" << endl; } break; case 'm': objectNum = get_object_num(); switch (objectNum) { case 1: if ( isEmpty(s1) ) cout << " s1 is empty" << endl; else cout << " Lowest value in s1 is " << findMin(s1) << endl; break; case 2: if ( isEmpty(s2) ) cout << " s2 is empty" << endl; else cout << " Lowest value in s2 is " << findMin(s2) << endl; break; case 3: if ( isEmpty(s3) ) cout << " s3 is empty" << endl; else cout << " Lowest value in s3 is " << findMin(s3) << endl; } break; case 'M': objectNum = get_object_num(); switch (objectNum) { case 1: if ( isEmpty(s1) ) cout << " s1 is empty" << endl; else cout << " Highest value in s1 is " << findMax(s1) << endl; break; case 2: if ( isEmpty(s2) ) cout << " s2 is empty" << endl; else cout << " Highest value in s2 is " << findMax(s2) << endl; break; case 3: if ( isEmpty(s3) ) cout << " s3 is empty" << endl; else cout << " Highest value in s3 is " << findMax(s3) << endl; } break; case 'p': case 'P': objectNum = get_object_num(); switch (objectNum) { case 1: if ( isEmpty(s1) ) cout << " s1: (empty)" << endl; else { cout << " s1: "; print_to_cout(s1); } break; case 2: if ( isEmpty(s2) ) cout << " s2: (empty)" << endl; else { cout << " s2: "; print_to_cout(s2); } break; case 3: if ( isEmpty(s3) ) cout << " s3: (empty)" << endl; else { cout << " s3: "; print_to_cout(s3); } } break; case 'r': case 'R': objectNum = get_object_num(); switch (objectNum) { case 1: reset(s1); cout << " s1 has been reset and is now empty" << endl; break; case 2: reset(s2); cout << " s2 has been reset and is now empty" << endl; break; case 3: reset(s3); cout << " s3 has been reset and is now empty" << endl; } break; case 's': case 'S': objectNum = get_object_num(); switch (objectNum) { case 1: cout << " Size of s1 is " << size(s1) << endl; break; case 2: cout << " Size of s2 is " << size(s2) << endl; break; case 3: cout << " Size of s3 is " << size(s3) << endl; } break; case 'x': objectNum = get_object_num(); delCount = 0; switch (objectNum) { case 1: if ( isEmpty(s1) ) cout << " s1 is empty" << endl; else { int minValue = findMin(s1); while ( delOne(s1, minValue) ) ++delCount; cout << " " << delCount << " copies of " << minValue << " has been deleted from s1" << endl; } break; case 2: if ( isEmpty(s2) ) cout << " s2 is empty" << endl; else { int minValue = findMin(s2); while ( delOne(s2, minValue) ) ++delCount; cout << " " << delCount << " copies of " << minValue << " has been deleted from s2" << endl; } break; case 3: if ( isEmpty(s3) ) cout << " s3 is empty" << endl; else { int minValue = findMin(s3); while ( delOne(s3, minValue) ) ++delCount; cout << " " << delCount << " copies of " << minValue << " has been deleted from s3" << endl; } } break; case 'X': objectNum = get_object_num(); delCount = 0; switch (objectNum) { case 1: if ( isEmpty(s1) ) cout << " s1 is empty" << endl; else { int maxValue = findMax(s1); while ( delOne(s1, maxValue) ) ++delCount; cout << " " << delCount << " copies of " << maxValue << " has been deleted from s1" << endl; } break; case 2: if ( isEmpty(s2) ) cout << " s2 is empty" << endl; else { int maxValue = findMax(s2); while ( delOne(s2, maxValue) ) ++delCount; cout << " " << delCount << " copies of " << maxValue << " has been deleted from s2" << endl; } break; case 3: if ( isEmpty(s3) ) cout << " s3 is empty" << endl; else { int maxValue = findMax(s3); while ( delOne(s3, maxValue) ) ++delCount; cout << " " << delCount << " copies of " << maxValue << " has been deleted from s3" << endl; } } break; case 'q': case 'Q': cout << "Quit option selected...bye" << endl; break; default: cout << choice << " is not a valid option...try again" << endl; } } while (choice != 'q' && choice != 'Q'); cin.ignore(999, '\n'); cout << "Press Enter or Return when ready..."; cin.get(); return EXIT_SUCCESS; } void print_menu() { cout << endl; cout << "The following choices are available: " << endl; cout << " a Query average for s1, s2 or s3" << endl; cout << " A Add s1, s2 or s3 to s1" << endl; cout << " c Set s3 to the combination of s1 and s2" << endl; cout << " e Check if s1, s2 or s3 is empty" << endl; cout << " E Check if any pair of {s1 s2 s3} is identical" << endl; cout << " f Find # of times a given value occurs in s1" << endl; cout << " i Insert a new value into s1, s2 or s3" << endl; cout << " k Remove 1 of a given value from s1, s2 or s3" << endl; cout << " K Remove all of a given value from s1, s2 or s3" << endl; cout << " m Query lowest value for s1, s2 or s3" << endl; cout << " M Query highest value for s1, s2 or s3" << endl; cout << " p Print s1, s2 or s3 (to stdout)" << endl; cout << " r Reset s1, s2 or s3 to become empty" << endl; cout << " s Query size for s1, s2 or s3" << endl; cout << " x Remove all lowest values from s1, s2 or s3" << endl; cout << " X Remove all highest values from s1, s2 or s3" << endl; cout << " q Quit this test program" << endl; } char get_user_command() { char command; cout << "Enter choice: "; cin >> command;
cout << command << " read." << endl; return command; } int get_object_num() { int result; cout << "Enter object # (1 = s1, 2 = s2, 3 = s3) "; cin >> result;
while ( ! cin.good() )
{
cerr << "Invalid integer input..." << endl; cin.clear(); cin.ignore(999, '\n'); cout << "Re-enter object # (1 = s1, 2 = s2, 3 = s3) "; cin >> result;
}
// cin.ignore(999, ‘\n’);
while (result != 1 && result != 2 && result != 3)
{
cin.ignore(999, ‘\n’);
cerr << "Invalid object # (must be 1, 2 or 3)..." << endl; cout << "Re-enter object # (1 = s1, 2 = s2, 3 = s3) "; cin >> result;
while ( ! cin.good() )
{
cerr << "Invalid integer input..." << endl; cin.clear(); cin.ignore(999, '\n'); cout << "Re-enter object # (1 = s1, 2 = s2, 3 = s3) "; cin >> result;
}
// cin.ignore(999, ‘\n’);
}
cout << result << " read." << endl; return result; } int get_integer() { int result; cout << "Enter integer value "; cin >> result;
while ( ! cin.good() )
{
cerr << "Invalid integer input..." << endl; cin.clear(); cin.ignore(999, '\n'); cout << "Re-enter integer value "; cin >> result;
}
// cin.ignore(999, ‘\n’);
cout << result << " read." << endl; return result; } void print_to_cout(SortedInt src) { for (int i = 1; i <= size(src); ++i) cout << valAt(src, i) << " "; cout << endl; }

a6: SortedInt.o assign06.o
g++ SortedInt.o assign06.o -o a6
SortedInt.o: SortedInt.cpp SortedInt.h
g++ -Wall -ansi -pedantic -c SortedInt.cpp
assign06.o: assign06.cpp SortedInt.h
g++ -Wall -ansi -pedantic -c assign06.cpp
test:
./a6 auto < a6test.in > a6test.out
clean:
@rm -rf SortedInt.o assign06.o
cleanall:
@rm -rf SortedInt.o assign06.o a6

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

// FILE: SortedInt.h – header file for SortedInt
//
// CONSTANT
// const int MAX_SIZE = ____
// MAX_SIZE is the highest # of entries that can
// be accommodated.
//
// FUNCTIONS
// bool isEmpty(const SortedInt& s)
// Pre: (none)
// Post: True is returned if the s is empty,
// otherwise false is returned.
// int size(const SortedInt& s)
// Pre: (none)
// Post: The # of entries in s is returned.
// int valAt(const SortedInt& s, int position)
// Pre: s is not empty and 1 <= position <= size() // Post: The value of the entry with the given position in s // is returned. // Note: For a non-empty SortedInt s, the entry with the lowest // value is at position 1 and the entry with the highest // value is at a position given by size(s). // int findMin(const SortedInt& s) // Pre: s is not empty. // Post: The lowest value in s is returned. // int findMax(const SortedInt& s) // Pre: s is not empty. // Post: The highest value in s is returned. // double findAvg(const SortedInt& s) // Pre: s is not empty. // Post: The average of s is returned. // int findFreq(const SortedInt& s, int target) // Pre: (none) // Post: The # of times in which target occurs in s is returned. // bool equal(const SortedInt& s1, const SortedInt& s2) // Pre: (none) // Post: True is returned if the s1 is equal or identical to s2, // otherwise false is returned. // Note: Two SortedInt's are equal (identical) if they both // contain the same # of entries AND the values of every // pair of corresponding entries are equal. // void reset(SortedInt& s) // Pre: (none) // Post: s is set to empty. // void insert(SortedInt& s, int newInt) // Pre: size(s) < MAX_SIZE // Post: A new entry with value newInt is added to s. // bool delOne(SortedInt& s, int target) // Pre: (none) // Post: If target is found to occur one of more times in s, // then the first occurrence of target is removed from s // and true is returned, otherwise s is unchanged and // false is returned. // void add(SortedInt& benend, SortedInt addend) // Pre: ( size(benend) + size(addend) ) <= MAX_SIZE // Post: All entries in addend are added to benend. // NOTE: addend is allowed to be benend itself. // QUIZ: Can you see why addend is not passed by const reference? // SortedInt combine(const SortedInt& s1, const SortedInt& s2) // Pre: ( size(s1) + size(s2) ) <= MAX_SIZE // Post: A SortedInt containing copies of all the entries in s1 // and s2 is returned. #ifndef SortedInt_H #define SortedInt_H const int MAX_SIZE = 10; struct SortedInt { int data[MAX_SIZE]; int used; }; bool isEmpty(const SortedInt& s); int size(const SortedInt& s); int valAt(const SortedInt& s, int position); int findMin(const SortedInt& s); int findMax(const SortedInt& s); double findAvg(const SortedInt& s); int findFreq(const SortedInt& s, int target); bool equal(const SortedInt& s1, const SortedInt& s2); void reset(SortedInt& s); void insert(SortedInt& s, int newInt); bool delOne(SortedInt& s, int target); void add(SortedInt& benend, SortedInt addend); SortedInt combine(const SortedInt& s1, const SortedInt& s2); #endif

// FILE: SortedInt.cpp
// Implementation file for SortedInt
// (See SortedInt.h for documentation.)
// INVARIANT for SortedInt:
// (1) Entries of the SortedInt are stored in a one-dimensional,
// compile-time array of integers whose size is MAX_SIZE;
// the member variable data references the array.
// (2) # of entries the SortedInt currently contains is stored
// in the member variable used.
// (3) Entries of SortedInt are stored sorted in non-decreasing
// order from data[0] through data[used – 1].
// (4) We DON’T care what is stored in any of the array elements
// from data[used] and beyond.
#include
#include
#include “SortedInt.h”
using namespace std;
bool isEmpty(const SortedInt& s)
{
cout << "isEmpty is not implemented yet..." << endl; return false; // dummy value returned } int size(const SortedInt& s) { cout << "size is not implemented yet..." << endl; return 0; // dummy value returned } int valAt(const SortedInt& s, int position) { cout << "valAt is not implemented yet..." << endl; return 0; // dummy value returned } int findMin(const SortedInt& s) { cout << "findMin is not implemented yet..." << endl; return 0; // dummy value returned } int findMax(const SortedInt& s) { cout << "findMax is not implemented yet..." << endl; return 0; // dummy value returned } double findAvg(const SortedInt& s) { cout << "findAvg is not implemented yet..." << endl; return 0.0; // dummy value returned } int findFreq(const SortedInt& s, int target) { cout << "findFreq is not implemented yet..." << endl; return 0; // dummy value returned } bool equal(const SortedInt& s1, const SortedInt& s2) { cout << "equal is not implemented yet..." << endl; return false; // dummy value returned } void reset(SortedInt& s) { cout << "reset is not implemented yet..." << endl; } void insert(SortedInt& s, int newInt) { cout << "insert is not implemented yet..." << endl; } bool delOne(SortedInt& s, int target) { cout << "delOne is not implemented yet..." << endl; return false; // dummy value returned } void add(SortedInt& benend, SortedInt addend) { cout << "add is not implemented yet..." << endl; } SortedInt combine(const SortedInt& s1, const SortedInt& s2) { cout << "combine is not implemented yet..." << endl; SortedInt result; return result; // dummy object returned }

Overview

Using the C-struct feature, design, implement and test a new (programmer-defined) data type that can be used to represent and manipulate a collection of sorted integers. Such a data type can be used, for instance, by an instructor to process test scores (assuming test scores are recorded as integral values); each instance (object) of the data type would be able to represent a group of related test scores in that case. The operations supported should include the following:

Checking to see if the collection is empty.

NOTE: A collection is empty if it doesn’t contain any values.

Finding the number of values in the collection.

Adding a new value to the collection.

NOTE: 

You should 
NOT
 simply append the new item to the end of the array and then use a sorting algorithm of some kind to sort the array. You also should 
NOT
 use any temporary arrays to perfom the insertion.

TIP: 

Adopt/adapt the StoreOrdered function of 
Assignment 4
.

Finding the collection’s lowest/highest value.

NOTE: 

The lowest/highest value is undefined if the collection is empty.

Finding the value at a given position in the collection, with position starting at 1 (i.e., array index 0 corresponds to position 1, array index 1 corresponds to position 2, and so on).

NOTE: 

A positional value is undefined if the collection is empty.

Finding the collection’s average.

NOTE: 

The average is undefined if the collection is empty.

Removing an occurrence (if exists) of a specified value from the collection.

Finding the number of occurences of a specified value in the collection.

Resetting the collection to an empty collection.

Adding a given collection into another collection.

NOTE: 

The given collection (addend) and the collection to be added to (benend) may be the same collection before the operation takes place (in which case the operation will result in “each of the items in the original collection is duplicated exactly once”).

TIP: 

The “adding a new value to collection” function (assuming implemented correctly) should prove useful here.

Combining two given collections into a third one (which is a new collection to be returned).

TIP: 

The “adding a new value to collection” function (assuming implemented correctly) should prove useful here.

Testing to see if two given collections are identical.

NOTE: 

Two collections are identical if they contain the same number of items and the values contained in every corresponding pair of items are equal.

Some Specifics

You will use a fixed-sized, compile-time array (and other supporting data members) to implement the new data type that can be used to declare variables (objects) each of which can represent a collection of up to MAX_SIZE 
integers. For the purpose of testing, set MAX_SISE to 10; your design and implementation of the data type, however, should enable the maximum size to be easily modified, i.e., only need to change the value that MAX_SIZE is set to.

Goal

To gain experience designing, implementing and testing a relatively simple programmer-defined data type using C-struct (and an action-oriented/procedural approach).

Supplied Files and Sample Executable

Supplied files

Sample executable

Some caveats:

It was compiled using one of CS department’s Linux machines. Thus, it may not run on machines that have different Unix operating systems (including different versions of Linux). It definitely will not run on Windows.

To use the file, you should first do the following: (1) download the posted file (Assign06SampleExe.zip) onto you local machine, (2) unzip the downloaded file to obtain a6, and (3) upload the unzipped file (a6) to the desired working directory on your Linux account.

You will most likely get an error message such as the one shown below when attempting to run the program (by entering ./a6 while in the directory containing the file):

bash: ./a6: Permission denied

If this happens, it is because the access permission for the file got changed during download/upload. To fix the problem, do the following while you are in the subdirectory containing the uploaded file (a6):

chmod +x a6

Let me know as soon as possible (via e-mail) if you face any difficulties using the file, or if you discover some errors in my program.

Your Tasks

Thoroughly study and make sure that you fully understand the supplied header file SortedInt.h and the supplied test driver file assign06.cpp – you shouldn’t have to make any changes to these files but you have to understand what’s in them.

NOTE: 

Your understanding (or lack thereof) of what’s provided may affect your ability to answer some questions in exams.

Implement all the functions whose specifications appear in the header file. For uniformity, start with the supplied (skeleton) implementation file SortedInt.cpp, where the 
invariant
 for the data type has already been written.

Compile a test program using SortedInt.h, SortedInt.cpp and assign06.cpp, and run the program using appropriate test cases. 

An appropriate Makefile has also been provided for your convenience. If you have this Makefile in the same folder that you put the other files (SortedInt.h, SortedInt.cpp, assign06.cpp, and a6test.in):

You can (re-)compile by simply entering make at the command line.

And you can quickly run all the minimum required test cases (you probably want to do this only at a point where your program is at least mostly working) by simply entering make test at the command line.

Deliverables

Source files: SortedInt.h, SortedInt.cpp, assign06.cpp, and Makefile.

Test run results:

You should at least test your implementation using the cases included in this 
test input file
. Be sure to check out this 
explanation page
 on how to use the file (and the utility of the Makefile mentioned above).

NOTE: 

During grading, your program will typically be tested much more thoroughly than the minimum cases required above.

 NOTES:

Obviously, you will need to use separate compilation.

Be sure to remove all irrelevant statements/comments in your code when submitting your work.

Be sure to totally remove (not just commenting out) the

cout << "... not implemented yet" << endl;

line and remove all irrelevant comments (like // dummy value returned) once you have written the code.

Be sure to read/follow the instructions on what/how to submit posted 
here
.

If you discover anything that appears incorrect, please let me know (through email) as soon as possible.

Be sure to check back often for updates and/or further information.

Assignment 6 Sample Test Input/Output Explanation 

To generate/present the results for an extensive number of test cases can be quite awkward for at least 2 reasons:

To manually generate and capture the test session can be quite tedious, time consuming, and boring.

The output (which includes many menu listings) when printed consumes many pages (doesn’t help in saving some trees, minimizing printer wear and tear, and avoiding attempts to staple pages together with undersized staplers, etc.).

We can avoid the above awkwardness by taking advantage of Linux’s support for input/output redirection. The following describes how I did so:

I first created an input file that captures the input keystrokes I would enter had I run the program interactively. This resulted in a6test.in (one of the files in 
Assignment 6 sample test input/output
).

I then uploaded a6test.in onto my Linux account, making sure that I placed it in the sub-directory where I had created my 
Assignment 6
 executable (which is named a6).

I then decided to have the corresponding output “redirected” to a file called a6test.out.

I then issued the following command at the Linux command prompt (note that input redirection is effected through < and output redirection through >):

./a6 auto < a6test.in > a6test.out

(Actually, I could have replaced auto with any other word and the result would still be the same.) 

 NOTES: 

You would want to do the input/output redirection only when you are ready to do and capture the test cases one last time (and all at once) for submission. When you are still in the midst of testing/debugging your program, you would still want to do things the usual interactive way: 

./a6

Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER