Closed

queue libraries

This project was awarded to smartpin for $17 USD.

Get free quotes for a project like this
Employer working
Awarded to:
Project Budget
$15 - $20 USD
Total Bids
10
Project Description

contd... All your classes should have separate header (.h) files and separate implementation files. Part of your assignment is also to write a Makefile to compile your program correctly. You can assume that the main file using your program is always going to be main.C. The Makefile should have three different targets that build the program differently: normal - build a normal executable just including the library code into the compilation. This is the way you have been doing it until now. static - build a static source library archive, (.a) file, for your library and link it with the provided main.C. shared - build a shared object library, (.so) file, for your library and link it with the provided main.C. Make sure that all your operators and function calls match exactly the specifications. Since our main program will be making the calls they will have to match otherwise they will not work. The provided sample main is only a sample and is not a complete test case by any means. You must call your library implementation file queue.C. A library header file containing the class definition and the prototypes for your functions must be in queue.h.

## Deliverables

In this assignment you will design and code the functions for a library of queues. Your library will create and perform several useful functions on queues. You will implement this library with a class. The name of your class MUST be queue. You are free to choose how to implement this library, so long as it matches the specifications given. Note that you are writing the library ONLY. Your code will not have a main. Here is a sample main.C. Do not submit this file. Your library will be tested with this main, as well as many others. The elements in the queue you will be creating are integers. A queue can contain any number integers, or none at all. The order of integers in the queue is important. Also, a queue can contain many instances of a number. The queues are FIFO queues. This means that the first elements in the queue are the first ones to be removed from the queue. Your library must follow these specifications: Allow user to create objects of type queue, both empty and nonempty. Format: queue data; /* Empty queue */ Format: queue data(A, 5); /* A is an int[], 5 is the number of elements in A to add to data in the same order they appear in the array. So the elements added would be A[0]..A[4]. There will always be enough values in the array */ Allow copying of a queue to an other one of two ways: copy constructor: queue * qp = new queue(data); or operator: queue q = data; Allow values in a queue to be added or removed Format: [url removed, login to view](A, 2); /* A is an int[], 2 is the number of elements to add to the queue data from A. Same as above A[0]..A[1] would be added to the end of the queue data. */ Format: [url removed, login to view](2); /* 2 is the number of elements to remove from the beginning of the queue data. */ Allow comparison operations on objects of type queue The following must be supported: Format: (data and test are of type queue ) if (data == test) ... Note: Comparisons on queues works in the following way: A B : The elements of queue A match exactly the elements of queue B, including the order of the elements. A B : The elements of queue A do not exactly match the elements of queue B, may differ only in order of the elements. A B : Every element in queue A is in queue B. Queue B might contain elements not in queue A. A B : Every element in queue A is in queue B. Queue B must contain additional elements not found in A. Allow cout of a queue (Do not just printout numbers, print the data in the order from oldest to newest separated with a comma, i.e. 1,2,3 would mean that 1 is the next to be removed and 3 was the last to have been added) Format: cout ``The content of the queue is '' data endl; Implement the following additional operators: queue union C = A + B. C contains the elements queue A, followed by the elements in queue B. Self assignment union A += B. Since we have + and = operators += will not be hard to implement. queue intersection C = A && B. C contains the elements that are contained in both queues. (multiple appearances of an element only if there are multiple appearances in both queues.) queue shuffle C = A * B. C contains only elements of queue A shuffled with the elements of B. ( C = { a1, b1, a2, b2, a3, b3, ...} ). If one queue has more elements than the other once all the elements from the queue with less elements have been added, all elements from the larger queue should be added. queue difference C = A / B. C contains the elements from queue A that do not appear in queue B any number of times. queue length (has to be called length) int = [url removed, login to view](); Where data is of type queue. Your queue class must have a correct memory management. If a queue is deleted all of its memory is to be deleted. This time we will make sure it works correctly. The queue class must be implemented by use of inheritance from a linked list class, i.e. you will most likely end up with 3 classes. contd...

## Platform

unix environment in c++ with g++ compiler

SUBMIT DATE

LAST UPDATED

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online