Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Define class Sales that has the following: private members: 1. int * sold_items: points to an array of integers. Each element in the array represents
Define class Sales that has the following: private members: 1. int * sold_items: points to an array of integers. Each element in the array represents the number of sold items in a day. The default value of any element in the array is 3. 2. int sales_size: it is the size of the sold_items array, it represents the number of days on which the item was sold. Its default value is 7. public functions: 1. One Constructor (parameterized and default) that takes a value to set all the elements of the array, and the size of the array. If any of these parameters is not passed, then its value is set to the default value. 2. Getter for the sales_size, don't write a setter for it. 3. Getter for the sold_items array at a given day, it receives an index and returns the stored value in that index in the sold_items array. Assume the index is in the proper range. 4. void set_sales(int value, int index): it sets the received value in the received index in the sold_items array. Assume the index is in the proper range. 5. int set_sales(int arr[], int sales_size): it copies the values arr to the sold_items array and then returns 1. This function works only if the passed array size equals the sold_items array size. Otherwise, it returns -111
Step 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