Programming Assignment 1: Representing, Managing andManipulating Travel Options
You may NOT do any of the following:
change any of the function names or signatures (parameter listsand types and return type)
introduce any global or static variables
use any arrays or vectors inside the TravelOptions class! Notfor this assignment!! (You may use them as you see fit in anydriver/tester programs you write)
You MAY do any of the following as you seefit:
Reminders:
Some functions eliminate list entries (e.g., prune_sorted). Don'tforget to deallocate the associated nodes (using the deleteoperator).
Please read the below code and complete the missing parts.
#ifndef _TRVL_OPTNS_H
#define _TRVL_OPTNS_H
#include
#include
#include
// using namespace std;
class TravelOptions{
public:
enum Relationship { better, worse, equal, incomparable};
private:
struct Node {
double price;
double time;
Node *next;
Node(double _price=0, double _time=0, Node* _next=nullptr){
price = _price; time = _time; next = _next;
}
};
/* TravelOptions private data members */
Node *front; // pointer for first node in linked list (or nullif list is empty)
int _size;
public:
// constructors
TravelOptions() {
front = nullptr;
_size=0;
}
~TravelOptions( ) {
clear();
}
  /**
  * func: clear
  * desc: Deletes all Nodes currently in the list
  * status: DONE
  */
void clear(){
Node *p, *pnxt;
  p = front;
  while(p != nullptr) {
  pnxt = p->next;
  delete p;
  p = pnxt;
  }
  _size = 0;
  front = nullptr;
}
  /**
  * func: size
  * desc: returns the number of elements in thelist
  * status: DONE
  */
int size( ) const {
  return _size;
}
/**
* func: compare
* desc: compares option A (priceA, timeA) with option B (priceB,timeA) and
* returns result (see enum Relationship above):
*
* There are four possible scenarios:
* - A and B are identical: option A and option B have identicalprice and time:
* ACTION: return equal
* - A is better than B: option A and B are NOT equal/identicalAND
* option A is no more expensive than option B AND
* option A is no slower than option B
* ACTION: return better
* - A is worse than B: option A and B are NOT equal/identicalAND
* option A is at least as expensive as option B AND
* option A is no faster than option B
* ACTION: return worse
* NOTE: this means B is better than A
* - A and B are incomparable: everything else: one option ischeaper and
* the other is faster.
* ACTION: return incomparable
*
* COMMENTS: since this is a static function, there is no callingobject.
* To call it from a client program, you would do something likethis:
*
  TravelOptions::Relationship r;
  double pa, ta, pb, tb;
// some code to set the four price/time variables
r = TravelOptions::compare(pa, ta, pb, tb);
if(r == TravelOptions::better)
std::cout << \"looks like option b is useless!\" <// etcetera
*
* status: TODO
*/
static Relationship compare(double priceA, double timeA,
double priceB, double timeB) {
return incomparable; // placeholder
}