$35
335 project 3
Priority Queue
1
1.) Create a template class for a max-heap by modifying the code given in the
notes for min-heap. Property of a max-heap: a binary tree has the heap order
property if every node is bigger than or equal to its two children.
2.) Create a class(or struct) for Customer, with member variables string name ,
int service time , and int priority level .
Implement a member function for Customer, SetPriorityLevel(), that uses the
rand() function from #include<cstdlib>, to set priority level to a random integer between 0 and 100. Make sure to call this function in your constructor.
Implement another member function, SetServiceTime(), that sets service time
to a random integer between 0 and 60. Do not call this function in your constructor.
3.) Modify the max-heap template class you created to be able to store Customer objects using priority level as the comparable metric.
Modify the max-heap template class function DeleteMax() to return the Customer object being deleted. Set the service time of the deleted customer using the function you created in part 2, then store this deleted customer in a
vector<Customer> history. Make sure history is always sorted from smallest to
largest service time (use std::sort, or find the correct position of the customer
and insert it there).
1