Question

In: Computer Science

I keep on get a redefinition error and an undefined error. Customer List (1) CustomerList() and...

I keep on get a redefinition error and an undefined error.

Customer List

(1) CustomerList() and ~CustomerList() - default constructor and destructor.

(2) bool addStore(Store*s) - Add an instance of store to the linked list. Return true if successful.

(3) Store *removeStore(int ID) - Locate a Store in the list if it exists, remove and return it.

(4) Store *getStore(int ID) - Locate a Store in the list and return a pointer to it.

(5) bool updateStore(int ID, char *name, char *addr, char *city, char *st, char *zip) - Locate a store in the list then update all its information. Return true if successful.

(6) void printStoreInfo() - Iterate over the list of store and have each print itself.


Employee Record

(1) Add a pointer to a class of type CustomerList called m_pCustomerList.

(2) Add a function CustomerList *getCustomerList to return the pointer to the EmployeeRecord's CustomerList object.

-------------------------------------------------------------

CustomerList.h

#pragma once;

#include

#include "Store.h"

class CustomerList

{

   public:

       Store *m_pHead;

       CustomerList();

       ~CustomerList();

       bool addStore(Store *s);

       Store *removeStore(int ID);

       Store *getStore(int ID);

       bool updateStore(int ID, char *name, char *addr, char *city, char *st, char *zip);

       void printStoresInfo();

  

};

----------------------------------------------------------------------------

CustomerList.cpp

#include

#include "CustomerList.h"

#include "Store.h"

using namespace std;

CustomerList::CustomerList()

{

   // Default constructor

}

CustomerList::~CustomerList()

{

   // Destructor

}

bool CustomerList:: addStore(Store *s)

{

  

   //creating a new instance

   s = new Store();

   if(s==NULL)

       return true;

}

Store *CustomerList::removeStore(int ID)

{

   Store *temp, *back;

   temp = m_pHead;

   back = NULL;

       while((temp != NULL)&&(ID != temp ->getStoreID()))

       {

           back=temp;

           temp=temp->m_pNext;

       }

   if(temp==NULL)

       return NULL;

   else if(back==NULL)

   {

       m_pHead = m_pHead ->m_pNext;

       return temp;

   }

  

   else

   {

       back -> m_pNext = temp-> m_pNext;

       return temp;

   }

   return NULL;

}

Store *CustomerList::getStore(int ID)

{

   Store *temp;

   temp = m_pHead;

   while((temp != NULL) && (ID != temp ->getStoreID()))

   {

       temp = temp->m_pNext;

   }

   if(temp == NULL)

       return NULL;

   else

   {

       Store *retStore = new Store;

       *retStore = *temp;

       retStore->m_pNext = NULL;

       return retStore;

   }

}

bool CustomerList::updateStore(int ID, char *name, char *addr, char *city, char *st, char *zip)

{

   return false;

}

void CustomerList::printStoresInfo()

{

   Store *temp;

   cout << " ===================================================================================== " << endl;

   if(m_pHead== NULL)

       cout << " The List is currently empty.\n" ;

   else

   {

       temp = m_pHead;

       while(temp != NULL)

       {

           cout << temp->m_pNext << endl;

       }

   }

}

--------------------------------------------------------------------------------

Store.h

#pragma once;

#include

#include

using namespace std;

class Store

{

   private:

       int       m_iStoreID;

       char   m_sStoreName[64];

       char   m_sAddress[64];

       char   m_sCity[32];

       char   m_sState[32];

       char   m_sZip[11];

   public:

       Store   *m_pNext;

       Store();                       // Default constructor

       Store(int ID,                   // Constructor

           char *name,

           char *addr,

           char *city,

           char *st,

           char *zip);

       ~Store();                       // Destructor

       int getStoreID();               // Get/Set store ID

       void setStoreID(int ID);

       char *getStoreName();           // Get/Set store name

       void setStoreName(char *name);

       char *getStoreAddress();       // Get/Set store address

       void setStoreAddress(char *addr);

       char *getStoreCity();           // Get/Set store city

       void setStoreCity(char *city);

       char *getStoreState();           // Get/Set store state

       void setStoreState(char *state);

       char *getStoreZip();           // Get/Set store zip code

       void setStoreZip(char *zip);

       void printStoreInfo();           // Print all info on this store

};

------------------------------------------------------------------------------

Store.cpp

#include "Store.h"

#include

using namespace std;

Store::Store()

{

   m_pNext = NULL;

}

Store::Store(int ID, char *name, char *addr, char *city, char *st, char *zip)

{

   m_iStoreID = ID;

   strcpy(m_sStoreName, name);

   strcpy(m_sAddress, addr);

   strcpy(m_sCity, city);

   strcpy(m_sState, st);

   strcpy(m_sZip, zip);

   m_pNext = NULL;

}

Store::~Store()

{

   // Nothing to do here

}


int Store::getStoreID()

{

   return m_iStoreID;

}

void Store::setStoreID(int ID)

{

   m_iStoreID = ID;

}

char *Store::getStoreName()

{

   char *name = new char[strlen(m_sStoreName) + 1];

   strcpy(name, m_sStoreName);

   return name;

}

void Store::setStoreName(char *name)

{

   strcpy(m_sStoreName, name);

}

char *Store::getStoreAddress()

{

   char *addr = new char[strlen(m_sAddress) + 1];

   strcpy(addr, m_sAddress);

   return addr;

}

void Store::setStoreAddress(char *addr)

{

   strcpy(m_sAddress, addr);

}

char *Store::getStoreCity()

{

   char *city = new char[strlen(m_sCity) + 1];

   strcpy(city, m_sCity);

   return city;

}

void Store::setStoreCity(char *city)

{

   strcpy(m_sCity, city);

}

char *Store::getStoreState()

{

   char *state = new char[strlen(m_sState) + 1];

   strcpy(state, m_sState);

   return state;

}

void Store::setStoreState(char *state)

{

   strcpy(m_sState, state);

}

char *Store::getStoreZip()

{

   char *zip = new char[strlen(m_sZip) + 1];

   strcpy(zip, m_sZip);

   return zip;

}

void Store::setStoreZip(char *zip)

{

   strcpy(m_sZip, zip);

}

void Store::printStoreInfo()

{

   cout << m_iStoreID << setw(20) << m_sStoreName << setw(15) << m_sAddress

       << setw(15) << m_sCity << ", " << m_sState << setw(10) << m_sZip << "\n";

}

----------------------------------------------------------

EmployeeRecord.h

#pragma once

#include "CustomerList.h"

class EmployeeRecord

{

  private:

          int m_iEmployeeID;

          char m_sLastName[32];

          char m_sFirstName[32];

          int m_iDeptID;

          double m_dSalary;

         

  public:

     

           CustomerList *getCustomerList();

           CustomerList *m_pCustomerList;


           //The default constructor

          EmployeeRecord();

           // Constructor shall set the member values passed into the function.

         EmployeeRecord(int ID, char *fName, char *lName, int dept, double sal);

           // The destructor

          ~EmployeeRecord();

         // shall return the value stored in the member variable

          int getID();

         // will set the member variable m_iEmployeeID to the value of its' argument.

          void setID(int ID);

         // The getName() function shall copy the member variables m_sFirstName and m_sLastName into the character arrays pointed to by the function arguments.

          void getName(char *fName, char *lName);

         // The setName() function will copy the function arguments into the member variables m_sFirstName and m_sLastName

          void setName(char *fName, char *lName);

         // The getDept() function shall be defined as a reference function. That is, a call to this function will copy the member variable m_iDeptID into the int variable referenced by the function argument.

          int getDept();

           // The setDept() function will copy the function argument into the member variable m_iDeptID.

          void setDept(int d);

           // The getSalary() function shall be defined as a pointer function.

          double getSalary();

         // The function setSalary() shall copy the function argument into the member variable m_dSalary.

          void setSalary(double sal);

         //This function shall print to the screen all data found in the employee's record

          void printRecord();

         

};

-----------------------------------------------------------------------------

EmployeeRecord.cpp

#include

#include "EmployeeRecord.h"

using namespace std;

//Default Constructor

EmployeeRecord::EmployeeRecord()

{

  // The default constructor shall set the member variables to the following

  m_iEmployeeID = 0;

  m_sFirstName[0] = '\0';

  m_sLastName[0] = '\0';

  m_iDeptID = 0;

  m_dSalary = 0.0;

}

EmployeeRecord::EmployeeRecord(int ID, char *fName, char *lName, int dept, double sal)

{

// Copying the member varibles for First and Last name

  strcpy(m_sFirstName, fName);

  strcpy(m_sLastName, lName);

  // Copying other member variables

  m_iEmployeeID = ID;

  m_iDeptID     = dept;

  m_dSalary     = sal;

fName = NULL;

lName = NULL;

}

// Default Desctrutor

EmployeeRecord::~EmployeeRecord()

{

  

  // It was tested in sprint 1

}

int EmployeeRecord:: getID()

{

/*cout <<"\n====================================="<< endl;

cout << "           Testing data:" << endl;

cout <<"====================================="<< endl;  

   // Testing ID

  cout << "Testing getID(). Result = " << m_iEmployeeID << endl;*/

  return m_iEmployeeID;

  

}

void EmployeeRecord::setID(int ID)

{

  m_iEmployeeID = ID;

/*cout <<"====================================="<< endl;

cout << "      Setting data in Record:" << endl;

cout <<"====================================="<< endl;  

cout << "ID = " << m_iEmployeeID << endl;*/

}

void EmployeeRecord::getName(char *fName, char *lName)

{

   //Copying member variables to parameters for name.

  strcpy(fName, m_sFirstName);

  strcpy(lName, m_sLastName);

  //cout << "Testing getName(). Result = " << m_sFirstName << " " << m_sLastName << endl;

}

void EmployeeRecord::setName(char *fName, char *lName)

{

   

   strcpy(m_sFirstName, fName);

   strcpy(m_sLastName, lName);

   //cout << "First Name = " << m_sFirstName <

   //cout << "Last Name = " << m_sLastName <

}

int EmployeeRecord::getDept()

{

  //Copying member variables to parameters for Dept ID

  return m_iDeptID;

  // testing getDept()

  //cout << "Testing getDept(). Result = " << d << endl;

}

void EmployeeRecord::setDept(int d)

{

  m_iDeptID = d;

  // cout << "Dept = " << m_iDeptID << endl;

}

double EmployeeRecord::getSalary()

{

  

  return m_dSalary;

   //cout << "Testing getSalary(). Result = " << *sal << endl;

   //cout << endl << endl;

}

void EmployeeRecord::setSalary(double sal)

{

  m_dSalary = sal;

  //cout << "Salary = $" << m_dSalary << "\n";

  //cout << endl << endl;

}

void EmployeeRecord::printRecord()

{

   // Print out Employee Record

   cout <<"                                           Print Record      " << endl

   cout << "ID: " << m_iEmployeeID << "\t";

   cout << "\tName: " << m_sLastName << " , " << m_sFirstName << "\t";

   cout << "\tDept: " << m_iDeptID << "\t" << "\t";

   cout << "Salary: $" << m_dSalary << "\t" << endl << endl;

}    

---------------------------------------------------------------------------------

MainProgram.cpp

#include

#include "EmployeeRecord.h"

#include

using namespace std;

int main()

{

   int employee_id = 100, dept_id = 42, IDNum;

   char fname [32];

   char lname [32];

   double salary = 65000;

   double salaryp;

   double *p_salary ;

   salaryp = 65000;

   p_salary = &salaryp;

     //=========================================================================EmployeeRecord Testing==========================================================================================

      

     EmployeeRecord *Employee1 = new EmployeeRecord(dept_id, fname, lname, dept_id, salary);

     Employee1->setID(employee_id);

     Employee1->setName("John", "Doe");

     Employee1->setDept(42);

     Employee1->setSalary(salary);

     IDNum = Employee1-> getID();

     Employee1->getName(fname,lname);

     Employee1->getDept();

     Employee1->getSalary();

     if(IDNum == employee_id)

         //Test Successful

     if((strcmp(fname, "John") == 0)&&(strcmp(lname,"Doe") == 0))

         //Test Successful

     if(dept_id == 42)

         //Test Successful

     if(*p_salary == salary)

         //Test Successful

     

     Employee1->printRecord();

      Employee1->setID(456);

     Employee1->setName("Jane", "Smith");

     Employee1->setDept(45);

     Employee1->setSalary(4000);

     IDNum = Employee1-> getID();

     Employee1->getName(fname,lname);

     Employee1->getDept();

     Employee1->getSalary();

     if(IDNum == 456)

         //Test Successful

     if((strcmp(fname, "Jane") == 0)&&(strcmp(lname,"Smith") == 0))

         //Test Successful

     if(dept_id == 45)

         //Test Successful

     if(*p_salary == 4000)

     Employee1->printRecord();


     //=====================================Customer List Testing====================================

     CustomerList *cl = Employee1 ->getCustomerList();

     //----Testing the addStore, and printStoresInfo functions:--------------------------------------

     Store *s = new Store(4567,"A Computer Store", "1111 Main St." ,"West City" ,"Alabama", "12345");

     cl -> addStore(s);

     cl -> printStoresInfo();

     //----------------------------------------------------------------------------------------------

     //---Testing the get store function:---------

     Store *s = NULL;

     s=cl->getStore(1234);

     if((s != NULL) && (s->getStoreID() == 1234))

       s = cl->getStore(9999);

     if(s == NULL)

     //-------------------------------------------

     //---Testing updateStore Function: ----------------------------------------------------------------------

     bool chk = cl->updateStore(1234, "Test Name", "1111 TestAddress", "TestCity", "TestState", "TestZip");

     if(chk)

         cl ->printStoresInfo();

     else

         cout << "updateStore test failed\n";

     bool chk = cl -> updateStore(9999, "NoName", "1111 NoAddress", "NoCity", "NoState", "NoZip");

     if(!chk)

         cout << "updateStore negative test passed.\n";

     else

         cout << "updateStore negative test failed.\n";

     //---------------------------------------------------------------------------------------------------------


     //--Testing the removeStore function---------------

     Store *s;

     s = cl ->removeStore(4567);

     if(s == NULL)

       Store *s = cl -> removeStore(4567);

       if(( s != NULL) && (s->getStoreID() == 4567))

     cl -> printStoresInfo();

       //------------------------------------------------

       //---Testing the destructor-----------------

       EmployeeRecord *e = new EmployeeRecord();

       delete e;

       //------------------------------------------

     system ("pause");

     return 0;

}






Solutions

Expert Solution

CustomerList.cpp

#include

#include "CustomerList.h"

#include "Store.h"

using namespace std;

CustomerList::CustomerList()

{

   // Default constructor

}

CustomerList::~CustomerList()

{

   // Destructor

}

bool CustomerList:: addStore(Store *s)

{

  

   //creating a new instance

   s = new Store();

   if(s==NULL)

       return true;

}

Store *CustomerList::removeStore(int ID)

{

   Store *temp, *back;

   temp = m_pHead;

   back = NULL;

       while((temp != NULL)&&(ID != temp ->getStoreID()))

       {

           back=temp;

           temp=temp->m_pNext;

       }

   if(temp==NULL)

       return NULL;

   else if(back==NULL)

   {

       m_pHead = m_pHead ->m_pNext;

       return temp;

   }

  

   else

   {

       back -> m_pNext = temp-> m_pNext;

       return temp;

   }

   return NULL;

}

Store *CustomerList::getStore(int ID)

{

   Store *temp;

   temp = m_pHead;

   while((temp != NULL) && (ID != temp ->getStoreID()))

   {

       temp = temp->m_pNext;

   }

   if(temp == NULL)

       return NULL;

   else

   {

       Store *retStore = new Store;

       *retStore = *temp;

       retStore->m_pNext = NULL;

       return retStore;

   }

}

bool CustomerList::updateStore(int ID, char *name, char *addr, char *city, char *st, char *zip)

{

   return false;

}

void CustomerList::printStoresInfo()

{

   Store *temp;

   cout << " ===================================================================================== " << endl;

   if(m_pHead== NULL)

       cout << " The List is currently empty.\n" ;

   else

   {

       temp = m_pHead;

       while(temp != NULL)

       {

           cout << temp->m_pNext << endl;

       }

   }

}

--------------------------------------------------------------------------------

Store.h

#pragma once;

#include

#include

using namespace std;

class Store

{

   private:

       int       m_iStoreID;

       char   m_sStoreName[64];

       char   m_sAddress[64];

       char   m_sCity[32];

       char   m_sState[32];

       char   m_sZip[11];

   public:

       Store   *m_pNext;

       Store();                       // Default constructor

       Store(int ID,                   // Constructor

           char *name,

           char *addr,

           char *city,

           char *st,

           char *zip);

       ~Store();                       // Destructor

       int getStoreID();               // Get/Set store ID

       void setStoreID(int ID);

       char *getStoreName();           // Get/Set store name

       void setStoreName(char *name);

       char *getStoreAddress();       // Get/Set store address

       void setStoreAddress(char *addr);

       char *getStoreCity();           // Get/Set store city

       void setStoreCity(char *city);

       char *getStoreState();           // Get/Set store state

       void setStoreState(char *state);

       char *getStoreZip();           // Get/Set store zip code

       void setStoreZip(char *zip);

       void printStoreInfo();           // Print all info on this store

};

EmployeeRecord.cpp

#include

#include "EmployeeRecord.h"

using namespace std;

//Default Constructor

EmployeeRecord::EmployeeRecord()

{

  // The default constructor shall set the member variables to the following

  m_iEmployeeID = 0;

  m_sFirstName[0] = '\0';

  m_sLastName[0] = '\0';

  m_iDeptID = 0;

  m_dSalary = 0.0;

}

EmployeeRecord::EmployeeRecord(int ID, char *fName, char *lName, int dept, double sal)

{

// Copying the member varibles for First and Last name

  strcpy(m_sFirstName, fName);

  strcpy(m_sLastName, lName);

  // Copying other member variables

  m_iEmployeeID = ID;

  m_iDeptID     = dept;

  m_dSalary     = sal;

fName = NULL;

lName = NULL;

}

// Default Desctrutor

EmployeeRecord::~EmployeeRecord()

{

  

  // It was tested in sprint 1

}

int EmployeeRecord:: getID()

{

/*cout <<"\n====================================="<< endl;

cout << "           Testing data:" << endl;

cout <<"====================================="<< endl;  

   // Testing ID

  cout << "Testing getID(). Result = " << m_iEmployeeID << endl;*/

  return m_iEmployeeID;

  

}

void EmployeeRecord::setID(int ID)

{

  m_iEmployeeID = ID;

/*cout <<"====================================="<< endl;

cout << "      Setting data in Record:" << endl;

cout <<"====================================="<< endl;  

cout << "ID = " << m_iEmployeeID << endl;*/

}

void EmployeeRecord::getName(char *fName, char *lName)

{

   //Copying member variables to parameters for name.

  strcpy(fName, m_sFirstName);

  strcpy(lName, m_sLastName);

  //cout << "Testing getName(). Result = " << m_sFirstName << " " << m_sLastName << endl;

}

void EmployeeRecord::setName(char *fName, char *lName)

{

   

   strcpy(m_sFirstName, fName);

   strcpy(m_sLastName, lName);

   //cout << "First Name = " << m_sFirstName <

   //cout << "Last Name = " << m_sLastName <

}

int EmployeeRecord::getDept()

{

  //Copying member variables to parameters for Dept ID

  return m_iDeptID;

  // testing getDept()

  //cout << "Testing getDept(). Result = " << d << endl;

}

void EmployeeRecord::setDept(int d)

{

  m_iDeptID = d;

  // cout << "Dept = " << m_iDeptID << endl;

}

double EmployeeRecord::getSalary()

{

  

  return m_dSalary;

   //cout << "Testing getSalary(). Result = " << *sal << endl;

   //cout << endl << endl;

}

void EmployeeRecord::setSalary(double sal)

{

  m_dSalary = sal;

  //cout << "Salary = $" << m_dSalary << "\n";

  //cout << endl << endl;

}

void EmployeeRecord::printRecord()

{

   // Print out Employee Record

   cout <<"                                           Print Record      " << endl

   cout << "ID: " << m_iEmployeeID << "\t";

   cout << "\tName: " << m_sLastName << " , " << m_sFirstName << "\t";

   cout << "\tDept: " << m_iDeptID << "\t" << "\t";

   cout << "Salary: $" << m_dSalary << "\t" << endl << endl;

}    

---------------------------------------------------------------------------------

MainProgram.cpp

#include

#include "EmployeeRecord.h"

#include

using namespace std;

int main()

{

   int employee_id = 100, dept_id = 42, IDNum;

   char fname [32];

   char lname [32];

   double salary = 65000;

   double salaryp;

   double *p_salary ;

   salaryp = 65000;

   p_salary = &salaryp;

     //=========================================================================EmployeeRecord Testing==========================================================================================

      

     EmployeeRecord *Employee1 = new EmployeeRecord(dept_id, fname, lname, dept_id, salary);

     Employee1->setID(employee_id);

     Employee1->setName("John", "Doe");

     Employee1->setDept(42);

     Employee1->setSalary(salary);

     IDNum = Employee1-> getID();

     Employee1->getName(fname,lname);

     Employee1->getDept();

     Employee1->getSalary();

     if(IDNum == employee_id)

         //Test Successful

     if((strcmp(fname, "John") == 0)&&(strcmp(lname,"Doe") == 0))

         //Test Successful

     if(dept_id == 42)

         //Test Successful

     if(*p_salary == salary)

         //Test Successful

     

     Employee1->printRecord();

      Employee1->setID(456);

     Employee1->setName("Jane", "Smith");

     Employee1->setDept(45);

     Employee1->setSalary(4000);

     IDNum = Employee1-> getID();

     Employee1->getName(fname,lname);

     Employee1->getDept();

     Employee1->getSalary();

     if(IDNum == 456)

         //Test Successful

     if((strcmp(fname, "Jane") == 0)&&(strcmp(lname,"Smith") == 0))

         //Test Successful

     if(dept_id == 45)

         //Test Successful

     if(*p_salary == 4000)

     Employee1->printRecord();


     //=====================================Customer List Testing====================================

     CustomerList *cl = Employee1 ->getCustomerList();

     //----Testing the addStore, and printStoresInfo functions:--------------------------------------

     Store *s = new Store(4567,"A Computer Store", "1111 Main St." ,"West City" ,"Alabama", "12345");

     cl -> addStore(s);

     cl -> printStoresInfo();

     //----------------------------------------------------------------------------------------------

     //---Testing the get store function:---------

     Store *s = NULL;

     s=cl->getStore(1234);

     if((s != NULL) && (s->getStoreID() == 1234))

       s = cl->getStore(9999);

     if(s == NULL)

     //-------------------------------------------

     //---Testing updateStore Function: ----------------------------------------------------------------------

     bool chk = cl->updateStore(1234, "Test Name", "1111 TestAddress", "TestCity", "TestState", "TestZip");

     if(chk)

         cl ->printStoresInfo();

     else

         cout << "updateStore test failed\n";

     bool chk = cl -> updateStore(9999, "NoName", "1111 NoAddress", "NoCity", "NoState", "NoZip");

     if(!chk)

         cout << "updateStore negative test passed.\n";

     else

         cout << "updateStore negative test failed.\n";

     //---------------------------------------------------------------------------------------------------------


     //--Testing the removeStore function---------------

     Store *s;

     s = cl ->removeStore(4567);

     if(s == NULL)

       Store *s = cl -> removeStore(4567);

       if(( s != NULL) && (s->getStoreID() == 4567))

     cl -> printStoresInfo();

       //------------------------------------------------

       //---Testing the destructor-----------------

       EmployeeRecord *e = new EmployeeRecord();

       delete e;

       //------------------------------------------

     system ("pause");

     return 0;

}


Related Solutions

I keep get this exception error Exception in thread "main" java.lang.NullPointerException    at Quadrilateral.returnCoordsAsString(Quadrilateral.java:44)    at...
I keep get this exception error Exception in thread "main" java.lang.NullPointerException    at Quadrilateral.returnCoordsAsString(Quadrilateral.java:44)    at Quadrilateral.toString(Quadrilateral.java:51)    at tester1.main(tester1.java:39) In this program I needed to make a Point class to create a coordinate square from x and y. I also needed to make a Quadrilateral class that has an instance reference variable to Point .The Quadrilateral class then inherits itself to other classes or in this case other shapes like square, trapazoid. I thought I did it right but...
Syntax error in C. I am not familiar with C at all and I keep getting...
Syntax error in C. I am not familiar with C at all and I keep getting this one error "c error expected identifier or '(' before } token" Please show me where I made the error. The error is said to be on the very last line, so the very last bracket #include #include #include #include   int main(int argc, char*_argv[]) {     int input;     if (argc < 2)     {         input = promptUserInput();     }     else     {         input = (int)strtol(_argv[1],NULL, 10);     }     printResult(input);...
I keep getting the same error Error Code: 1822. Failed to add the foreign key constraint....
I keep getting the same error Error Code: 1822. Failed to add the foreign key constraint. Missing index for constraint 'test_ibfk_5' in the referenced table 'appointment', can you please tell me what is wrong with my code: -- Table III: Appointment = (site_name [fk7], date, time) -- fk7: site_name -> Site.site_name DROP TABLE IF EXISTS appointment; CREATE TABLE appointment (    appt_site VARCHAR(100) NOT NULL, appt_date DATE NOT NULL, appt_time TIME NOT NULL, PRIMARY KEY (appt_date, appt_time), FOREIGN KEY (appt_site)...
BSTree.java:99: error: reached end of file while parsing } I get this error when i run...
BSTree.java:99: error: reached end of file while parsing } I get this error when i run this code. can someone help me out? I can't figure out how to make this work. public class BSTree<T extends Comparable<T>> { private BSTreeNode<T> root = null; // TODO: Write an addElement method that inserts generic Nodes into // the generic tree. You will need to use a Comparable Object public boolean isEmpty(){ return root == null; } public int size(){ return node;} public...
I keep getting an error that I cannot figure out with the below VS2019 windows forms...
I keep getting an error that I cannot figure out with the below VS2019 windows forms .net framework windows forms error CS0029 C# Cannot implicitly convert type 'bool' to 'string' It appears to be this that is causing the issue string id; while (id = sr.ReadLine() != null) using System; using System.Collections.Generic; using System.IO; using System.Windows.Forms; namespace Dropbox13 { public partial class SearchForm : Form { private List allStudent = new List(); public SearchForm() { InitializeComponent(); } private void SearchForm_Load(object...
I am making a html game with phaser 3 I keep getting an error at line...
I am making a html game with phaser 3 I keep getting an error at line 53 of this code (expected ;) I have marked the line that needs to be fixed. whenever I add ; my whole code crashes const { Phaser } = require("./phaser.min"); var game; var gameOptions = {     tileSize: 200,     tileSpacing: 20,     boardSize: {     rows: 4,     cols: 4     }    }    window.onload = function() {     var gameConfig = {         width: gameOptions.boardSize.cols * (gameOptions.tileSize +             gameOptions.tileSpacing) + gameOptions.tileSpacing,...
I keep getting this error "LetterDemo.cs(21,14): error CS1519: Unexpected symbol `string' in class, struct, or interface...
I keep getting this error "LetterDemo.cs(21,14): error CS1519: Unexpected symbol `string' in class, struct, or interface member declaration" Can someone please help me. Here is my code: using static System.Console; class LetterDemo {    static void Main()    {      Letter letter1 = new Letter();      CertifiedLetter letter2 = new CertifiedLetter();      letter1.Name = "Electric Company";      letter1.Date = "02/14/18";      letter2.Name = "Howe and Morris, LLC";      letter2.Date = "04/01/2019";      letter2.TrackingNumber = "i2YD45";      WriteLine(letter1.ToString());      WriteLine(letter2.ToString() +       " Tracking number: " + letter2.TrackingNumber);    } } class Letter {...
My code works in eclipse, but not in Zybooks. I keep getting this error. Exception in...
My code works in eclipse, but not in Zybooks. I keep getting this error. Exception in thread "main" java.util.NoSuchElementException at java.base/java.util.Scanner.throwFor(Scanner.java:937) at java.base/java.util.Scanner.next(Scanner.java:1478) at Main.main(Main.java:34) Your output Welcome to the food festival! Would you like to place an order? Expected output This test case should produce no output in java import java.util.Scanner; public class Main {    public static void display(String menu[])    {        for(int i=0; i<menu.length; i++)        {            System.out.println (i + " - " + menu[i]);...
HI. I have been trying to run my code but I keep getting the following error....
HI. I have been trying to run my code but I keep getting the following error. I can't figure out what I'm doing wrong. I also tried to use else if to run the area of the other shapes but it gave me an error and I created the private method. Exception in thread "main" java.util.InputMismatchException at java.base/java.util.Scanner.throwFor(Scanner.java:939) at java.base/java.util.Scanner.next(Scanner.java:1594) at java.base/java.util.Scanner.nextInt(Scanner.java:2258) at java.base/java.util.Scanner.nextInt(Scanner.java:2212) at project2.areacalculation.main(areacalculation.java:26) My code is below package project2; import java.util.Scanner; public class areacalculation { private static...
In java, I keep getting the error below and I can't figure out what i'm doing...
In java, I keep getting the error below and I can't figure out what i'm doing wrong. Any help would be appreciated. 207: error: not a statement allocationMatrix[i][j];
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT