Question
Language = C++ Thank you! ------------------------------------------------CustomerArray.h-------------------------------------------------------------------------------------- #ifndef CUSTOMERARRAY_H #define CUSTOMERARRAY_H #include Customer.h class CustomerArray { public: CustomerArray(); ~CustomerArray(); int add(Customer*); Customer* get(int); int getSize(); private:
Language = C++ Thank you!
------------------------------------------------CustomerArray.h--------------------------------------------------------------------------------------
#ifndef CUSTOMERARRAY_H #define CUSTOMERARRAY_H
#include "Customer.h"
class CustomerArray { public: CustomerArray(); ~CustomerArray(); int add(Customer*); Customer* get(int); int getSize(); private: Customer* elements[MAX_CUSTOMERS]; int size; };
#endif
------------------------------------------------CustomerArray.cc--------------------------------------------------------------------------------------
#include "CustomerArray.h" #include "Customer.h" #include "defs.h"
//add code here
------------------------------------------------Customer.h--------------------------------------------------------------------------------------
#ifndef CUSTOMER_H #define CUSTOMER_H
#include
class Customer {
public: Customer(string="", string="", string="", string=""); int getId(); string getFname(); string getLname(); string getAddress(); string getPhoneNumber(); int getNumVehicles(); VehicleArray& getVehicles(); int addVehicle(Vehicle*); private:
static int nextId; int id; string firstName; string lastName; string address; string phoneNumber; VehicleArray vehicles; };
#endif
------------------------------------------------defs.h--------------------------------------------------------------------------------------
#ifndef DEFS_H #define DEFS_H
#define MAX_VEHICLES 4 #define MAX_CUSTOMERS 6
#define C_OK 0 #define C_NOK -1
#endif
. The constructor simply initializes the size data member properly, . The destructor must iterate over the stored objects (which are to be dynamically allocated, discussed below), freeing the allocated memory for each one. The getSize function is a simple, one line getterStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started