Reference no: EM132222464
Assignment 1
Implement the following specification of UnsortedType using a circular linked list as the implementation structure.
template class <ItemType>
struct NodeType;
/* Assumption: ItemType is a type for which the operators
"<" and "==" are defined-either an appropriate built-in type or a class that overloads these operators. */
template <class ItemType>
class UnsortedType
{
public:
// Class constructor, destructor, and copy constructor
UnsortedType();
~UnsortedType();
UnsortedType(const UnsortedType<ItemType>&);
void operator=(UnsortedType<ItemType>);
bool IsFull() const;
// Determines whether list is full.
// Post: Function value = (list is full)
int GetLength() const;
// Determines the number of elements in list.
// Post: Function value = number of elements in list.
void RetrieveItem(ItemType& item, bool& found);
// Retrieves list element whose key matches item's key
// (if present).
// Pre: Key member of item is initialized.
// Post: If there is an element someItem whose key matches
// item's key, then found = true and item is a copy of
// someItem; otherwise found = false and item is
// unchanged.
// List is unchanged.
void InsertItem(ItemType item);
// Adds item to list.
// Pre: List is not full.
// item is not in list.
// Post: item is in list.
void DeleteItem(ItemType item);
// Deletes the element whose key matches item's key.
// Pre: Key member of item is initialized.
// One and only one element in list has a key matching
// item's key.
// Post: No element in list has a key matching item's key.
void ResetList();
// Initializes current position for an iteration through the
// list.
// Post: Current position is prior to list.
void GetNextItem(ItemType&);
// Gets the next element in list.
// Pre: Current position is defined.
// Element at current position is not last in list.
// Post: Current position is updated to next position.
// item is a copy of element at current position.
private:
NodeType<ItemType>* listData;
int length;
NodeType<ItemType>* currentPos;
};
Deliverables
- A listing of the specification and implementation files for UnsortedType
- A listing of the driver program for your test plan
- A listing of the test plan as input to the driver
- A listing of the output from the driver
Programming Assignment 2
A toy that many children play with is a base with three pegs and five disks of different diameters. The disks begin on one peg, with the largest disk on the bottom and the other four disks added on in order of size. The idea is to move the disks from the peg they are on, to another peg by moving only one disk at a time and without ever putting a larger disk on top of a smaller one. This child's toy is actually an example of a classic mathematical puzzle called the Towers of Hanoi problem.
Write a recursive solution to this problem. It may take you a while to see the solution, but the program itself is quite short.
Input
The program should prompt for and input the number of Rings.For this program please use 3 pegs and 5 rings.
Output
The series of moves should be written to the screen, properly labeled.
Deliverables
• A listing your program
• A copy of your screen output
Programming Assignment 3
Your assignment is to implement a Binary Search Tree using the employee class you developed in Week 2. The employee class should contain the employee information listed in the "input" section below. The program should contain all functions listed in the functionality section below.
Input
Data about current employees should be on the file "Employee.txt". You will need to create your own employee file and submit it with the final project.
Each employee should have the following attributes:
• Employee_Number Integer
• Employee_Last_Name String
• Employee_First_Name String
• Employee_Years_of_Service Integer
3 employees must be loaded from the Employee.txt file on program start up.
Functionality
Command
|
Processing
|
ADD
|
Allows the user to "Add" an employee to the tree
|
REMOVE
|
Allows the user to "Remove" an employee from the tree
|
COUNT
|
Returns the number of Employees in the tree
|
PRINT
|
Prints the employee information in the list to the console
|
QUIT
|
Stops processing
|
Output
All output should be on the console.
Data Structures
This program should utilize a binary search tree.
Deliverables
• Neat and well commented program
• Complete zipped Visual Studio Project