Starting from:

$29.99

Lab 03 - Array Ordering Problems

Lab 03 - Array Ordering Problems
Direction: Submit typed work in the Labs directory of your github repository, dropbox, or google classroom assignment.
Each part should be a separate files. The files named should be ''lab3A.cpp'' and ''lab3B.h'' respectively.
Part A: In class
Your objective is to write a program that defines the following function
 Define a bool function named IsSorted() that takes a generic array parameter and an int parameter respectively.
Given that the int parameter represents the size of the array parameter, the function returns true if the array
is sorted in ascending order; otherwise, it returns false.
Part B: Take home
Your objective is to define the generic class named Set which represents a set with a maximum capacity of 100 where
a set is a collection of distinct objects. For the class, you must include the following:
 A private generic array field of size 100 that represents the set.
 A private int field that represents the current size of the set.
 A public default constructor that assigns the default generic value to each element of the array field and assigns
0 to the int field.
 A public copy constructor.
 A public assignment operator.
 A public empty destructor.
 A public void method named Add() that takes a constant generic reference parameter. It adds the parameter to
the set if it is not already a member of the set.
 A public void method named Remove() that takes a constant generic reference parameter. It removes the element
of the set that equals to the parameter if the parameter is a member of the set.
 A public bool constant method named IsFull() that takes no parameters. It returns true if the set is full;
otherwise, it returns false.
 A public bool constant method named IsEmpty() that takes no parameters. It returns true if the set is empty;
otherwise, it returns false.
 A public int constant method named Count() that takes no parameters. It returns the count of the set.
 A public bool constant method named Contains() that takes a constant generic reference parameter. It returns
true if the parameter is a member of the set; otherwise, it returns false.
 A public constant method named ToString() that takes no parameters. It returns a string of elements of the set
separated by commas all enclosed in curly braces.
 A friend overloaded ostream operator. It displays the elements of the set in the same format as ToString().

More products