in the program below is the member variable string usrn necessary?
#ifndef MYDATASTORE_H
#define MYDATASTORE_H
#include "datastore.h"
#include "util.h"

#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <map>



class MyDataStore : public DataStore
{

  public:

  // from datastore class
    void delete_prods_users();
    void addProduct(Product* p);
    void addUser(User* u);
    std::vector<Product*> search(std::vector<std::string>& terms, int type);
  // from part 1
    void add(std::string usrn_, Product *p);
    void buy(std::string usrn_);
    void view(std::string usrn_);
    void dump(std::ostream& ofile);
    
  // variables


    std::string usrn_;
    std::vector<Product*> search_hits;
    std::map<std::string, std::vector<Product*>> cart; // username to product vector
    std::map<std::set<std::string>, Product*> keyword_map; // keywords set to product
    std::map<std::string, User*> user_to_id; // username to user
    std::set<Product*> all_products;
    std::set<User*> all_users;




};


void MyDataStore::addProduct(Product *p)
{
  keyword_map.insert({p->keywords(), p});
  all_products.insert(p); // for dump output later only

}

void MyDataStore::addUser(User *u)
{
  all_users.insert(u); // for dump output later only
  user_to_id.insert({u->getName(), u});
  
}

std::vector<Product*> MyDataStore::search(std::vector<std::string>& terms, int type)
{
  std::vector<Product*> item_list;
  
  if(type == 0) // run and -- work on this
  {
    std::set<std::string> combined;
    std::set<std::string> temp(terms.begin(), terms.end());
    
    

    std::map<std::set<std::string>, Product*>::iterator it; // keywords set to product
    for(it = keyword_map.begin(); it != keyword_map.end(); it++)
    {
      std::set<std::string> keyword_two = it->first;

      combined = setIntersection(keyword_two, temp);
      
      if(combined.size() == temp.size())
      {
        item_list.push_back(it->second);
      }
    }
  }
  if(type == 1) // run or -- good
  {
    std::set<std::string> combined;
    std::set<std::string> temp(terms.begin(), terms.end());

    std::map<std::set<std::string>, Product*>:: iterator it; // keywords set to product
    for(it = keyword_map.begin(); it != keyword_map.end(); it++)
    {
      std::set<std::string> keyword_two = it->first;
      combined = setIntersection(keyword_two, temp);
      if(combined.size() > 0)
      {
        item_list.push_back(it->second);
      }
    }

  }

  this->search_hits = item_list;
  return item_list;

}

void MyDataStore::add(std::string usrn_, Product *p)
{
  if(user_to_id.find(usrn_) != user_to_id.end())
  {
    cart[usrn_].push_back(p);
  } else {
    std::cout << "Invalid username" << endl;
  }

}

void MyDataStore::buy(std::string usrn_)
{


  // make an iterator to go through cart
  //

  
  if(user_to_id.find(usrn_) != user_to_id.end())
  {
    double amount;
    for(int unsigned i = 0; i < cart[usrn_].size(); i++) 
    {
      amount = 0;
      amount += cart[usrn_][i]->getPrice(); // charge the user
      if(user_to_id[usrn_]->getBalance() >= amount && cart[usrn_][i]->getQty() > 0)
      {
        cart[usrn_][i]->subtractQty(1); // reduce the quantity by 1
        user_to_id[usrn_]->deductAmount(amount);
        cart[usrn_].erase(cart[usrn_].begin()+i);
        i--; // change to program
      }
      
    }
  } else {
    std::cout << "Invalid username" << endl;

  }


}


void MyDataStore::view(std::string usrn_)
{
  int item_num = 0;
  if(user_to_id.find(usrn_) != user_to_id.end())
  {
    std::vector<Product*>::iterator itr;
    for(itr = cart[usrn_].begin(); itr != cart[usrn_].end(); itr++)
    {
      item_num++;
      cout << "Item ";
      cout << item_num << endl;
      cout << (*itr)->displayString() << endl; // displays the string
    }
  } else {
    std::cout << "Invalid username" << endl;
  }
}

void MyDataStore::dump(std::ostream& ofile)
{
  ofile << "<products>" << endl;
  std::set<Product*>::iterator itr;
  for(itr = all_products.begin(); itr != all_products.end(); itr++)
  {
    (*itr)->dump(ofile); // runs the product dump functions for each product in the cart
  }
  ofile << "</products>" << endl;

  ofile << "<users>" << endl;
  std::set<User*>::iterator it;
  for(it = all_users.begin(); it != all_users.end(); it++)
  {
    (*it)->dump(ofile);

  }
  ofile << "</users>" << endl;

}

void MyDataStore::delete_prods_users()
{
  std::set<Product*>::iterator itr;
  for(itr = all_products.begin(); itr != all_products.end(); itr++)
  {
    delete (*itr); // runs the product dump functions for each product in the cart
  }

  std::set<User*>::iterator it;
  for(it = all_users.begin(); it != all_users.end(); it++)
  {
    delete (*it); // runs the product dump functions for each product in the cart
  }
}