Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need some help with C++ questions. These are the screenshots of the question,

ID: 3596241 • Letter: I

Question

I need some help with C++ questions.

These are the screenshots of the question, File.cpp, File.hpp and some definition, in the order.

The only includes I'm allowed are < list >, < vector >, and >.

Thanks in advance. :)

add customer functionality The add customer functions take in customer IDs and create accounts for them. This requires you to check if a customer with the given ID is already enrolled or not. If they are enrolled already, you do not make any changes for that ID. In the case of a list of IDs, continue on within the list. In either case, you should return false at the end

Explanation / Answer

/*Assuming customer records from file has been read in a list of Customers in the Bankdata class*/

bool BankData::add_customer(const size_t customer_id, const double& balance){
   customer c = new dCustomerIDNode(customer_id, balance);

   dCustomerIDNode *p = head //head is pointing to list of existing customers
   while (p->next != NULL && p->_customer_id != customer_id)
         p = p->next;
   if (p->next == NULL && p->_customer_id != customer_id){
       p->next = c;
       c->next = NULL;
       return true;
   }
   else {
      return false;
   }
  
}

bool BankData::add_customer(const size_t customer_id, const double& balance=0){
   customer c = new dCustomerIDNode(customer_id, balance);

   dCustomerIDNode *p = head //head is pointing to list of existing customers
   while (p->next != NULL && p->_customer_id != customer_id)
         p = p->next;
   if (p->next == NULL && p->_customer_id != customer_id){
       p->next = c;
       c->next = NULL;
       return true;
   }
   else {
      return false;
   }
  
}


bool add_customer(const CSE250::dCustomerIDNode* customer_list){

dCustomerIDNode *p = customer_list;

while (p != NULL){
       if !(add_customer(p->_customer_id,0))
           return false;
       p = p->next;
}
return true;
}