Question: C + + ONLY PLEASE This assignment has three parts. First, you will need to have a Product structure which will be contained in the
C ONLY PLEASE
This assignment has three parts.
First, you will need to have a Product structure which will be contained in the Store.h file. Its
members are:
int UPC
string desc
double qty
In the Store.h file, which contains the Store class are the following private member variables:
Member Variable
Location
Description
storeNumber An int that holds an Storess ID number. The store numbers are
assigned below via the use of the overloaded constructor.
storeLocation A string that holds a Stores Location, the Location may contain
a space. such as: John Doe. The store locations are assigned
below via the use of the overloaded constructor.
ptrProd A pointer to an array of Products.
yearsInBusiness An integer that contains the number of years the store has
been in business. This is also set via the use of the overloaded
constructor to the values shown below.
nextIndex A integer containing the index in the Products array that points
to the next element in the array to be processed.
capacity An integer that contains the number of elements in the array
containing the stores Products.
countProducts The number of different products in the store.
The class should have the following public member functions. You may not create more
member functions than those listed below:
Member Function
Location Description
Constructor
This constructor will set
StoreNumber to be
StoreLocation to be unassigned
yearsInBusiness to be
nextIndex
capacity;
coountProducts
ptrProd points to dynamically allocate memory with the size of
capacity
Overloaded
constructor
This constructor should have four input parameters, integer for
StoreNumber, a string for StoreLocation, an integer for
yearsInBusiness, and an integer for capacity. Each parameter should
be assigned to the corresponding member attributes. The remaining
attributes should be initialized as the default constructor does.
Destructor
The destructor
display a message in the following format:
The destructor is running for storeNumberstoreLocation eg The
destructor is running for store Main Street
And then
it should reset
StoreNumber to be
StoreLocation to be unassigned
yearsInBusiness to be
nextIndex to be
capacity to be
countProducts to be
release the dynamically allocate memory
setStoreNumber Accepts an int argument and copies it into the StoreNumber member
variable
setStoreLocation Accepts a string argument and copies it into the StoreLocation
member variable
setYearsinBusiness Accepts an integer argument and copies it into the YearsInBusiness
member variable
getStoreLocation Returns the value in StoreLocation
getStoreNumber Returns the value in StoreNumber
getYearsInBusiness Returns the value in YearsInBusiness
addProduct Inserts a product into the stores product array and increments
countProducts.
getNextProduct Returns the product in the array pointed to by nextIndex and
increments nextIndex.
resetIndex Sets the value of nextIndex to zero. Must execute this function before
the display can work.
getCount Returns the countProducts value.
Class declarations should be in Store.h and member function definitions should be in
Store.cpp Do not define any inline functions. The driver program should be in a file Location
StoreDrivercpp
Driver program StoreDrivercpp should have only the following two functions. It should also
dynamically allocate a Store array of elements.
const int SIZE ;
Store ptrStore new StoreSIZE;
Then set the Store data as follows:
Store: number locationMain Street years in business
Store number locationPine Street years in business
Store number locationTelegraph Road, years in business
int displayStoreStore &store Use the sample output below for the
format. Make sure to include the totals
shown. Return the total value for the
store in order to calculate the sum for all
stores.
void loadStoreStore &store, string
file
Use the included data files for each store
to load the products associated with each
store.. Stores data file is Productstxt
Stores data file is Productstxt Stores
data file is Productstxt
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
