Question: USE C++ programing Recall that in object-oriented programming, a class is intended to represent an object in real life. Recall also that a data structure
USE C++ programing
Recall that in object-oriented programming, a class is intended to represent an object in real life. Recall also that a data structure is a specialized object for storing and manipulating specific data or collections of data. For this exam, you are to create a Package object as well as a linked data structure to keep track of several Package objects and enable sorting and searching through the linked structure to optimize Delivery. Subsequently, you will need to create a driver to demonstrate use of the class objects you created.
You are free to make the following assumptions:
All necessary include statements have been added (as well as include statements for headers you create) using namespace std; already included Comments are helpful, but not required (remember that writing down algorithm as comments may help you receive partial credits) Use of the keyword const is not required for full credits
Package class
Properties: - Description of package - Weight of package in lbs. - Invariants enforced
Actions: - Compare with another Package object for sorting purposes (any comparison overload) - Display data of the Package object using the << overload, e.g. Friend osstream& operator<<(ostream &outstream, const Package &pkg);
Delivery Manager class
Note: under this class, you are expected to create the necessary node/linked structures as well as subsequent sort/search algorithms yourself (assume you dont have access to vector, STL, etc.)
Properties: - Linked structure containing Package objects - Total number of Package objects - Total number of drones needed (packages are delivered by drones see below)
Actions: - At least one Constructor overload - Keep track of more Package objects (i.e. Add(Package)). Be sure to update number of drones needed. - Assume each package up to 10 lbs. can be delivered by a single drone.
- Assume that packages weighing more than 10 lbs. must be delivered by multiple drones (e.g. two drones can deliver a package weighing up to 20 lbs., three drones can deliver a package weighing up to 30 lbs. etc.).
- Sort Package objects from least to most heavy (or vice versa) - Use of recursion - Use of the comparison overload of the Package object - One search method (for the list) given an argument (e.g. description, weight, etc. in other words, if you have a search for weight, you dont need to write another search method for description and vice versa) - Destructor that clears out the list (calls delete)
Driver code
- Creation of a Delivery Manager - Creation of a Package with valid invariants - Creation of a Package with invalid invariants (what should it do?) - Creation and adding a Package weighing less than 10 lbs. to Delivery Manager - Creation and adding a Package weighing no less than 20 lbs. to Delivery Manager - Comparing two Packages using the comparison overload - Printing out the description of all Package objects in the Delivery Manager
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
