Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in C++ Define class Sales that has the following: - private members: 1. int * sold_items: points to an array of integers. Each element in

image text in transcribed
image text in transcribed
image text in transcribed
in C++
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, dont 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 in 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.
Define class Item which has the following:
- private data members:
1. double price: represents the price of the item. Its default value is 5.
- protected data members:
1. Sales item_sales: an object of class Sales that represents the sales of an item.
- public data members:
1. const double cost: it represents the cost of the item. Its default value is 1.
- Public functions:
1. One constructor (parameterized and default): it takes a value to set all the elements of the sold_items array, its size, price, and cost. If any of these parameters is not passed, then its value is set to the default value.
2. Getter and setter for the price.
3. Getter for the item_sales object.
4. void show_report(): it prints the item price, cost, and the number of days on which it was sold.
Define class Clothing_Item which is an Item that has following:
- private data members:
1. int clothing_size: it represents the size of the clothing item. Its default value is 0.
2. static int counts: initialized to 0. It counts the number of Clothing_Item objects created so far.
- public functions:
1. One constructor (parameterized and default): it takes a value to set all the elements of the sold_items array, its size, price, cost, and the size of the clothes. If any of these parameters is not passed, then its value is set to the default value.
2. Getter for the clothing_size data member.
3. Getter for the counts data member, make it a static function.
4. multiply_price(double factor): it updates the price to be the multiplication of the price by the factor.
5. Override the show_report function to call the show_report function of the Item class and print the size of the clothing item.
6. A friend function duplicateMaxSales(Clothing_Item & item): it doubles the maximum sales value in the sold_items array. Example: if the maximum value in the sold_items array is 10, then it becomes 20.
In the driver program define the following:
non-member function of the following form to do the following:
void operations(Clothing_Item c[], int size, int i, int sales_value)
If the value in the sold_items array in the index (i) is smaller than the sales_value, then replace the value in the sold_items array at that index with the sales_value. Do that for all objects in the c array.
The following example shows the sold_items arrays of each Clothing_Item object in c array.
c elements sold_items
c[0] -----> {3, 4, 4, 5}
c[1] -----> {4, 3, 3, 7}
c[2] -----> {7, 3, 8, 3}
If the index (i) is 2 and the sales_value is 6. Then the sold_items arrays of each Clothing_Item object in c array should be as follows:
c elements sold_items
c[0] -----> {3, 4, 6, 5}
c[1] -----> {4, 3, 6, 7}
c[2] -----> {7, 3, 8, 3}
Write the main function to do the following:
a. Define an array of 4 Clothing_Item objects.
b. Ask the user to enter sales for 7 days. Then, set these sales in the sold_items array for the last object in the Clothing_Item array.
c. Double the price of the second object in the Clothing_Item array.
d. Call duplicateMaxSales function for the last object in the Clothing_Item array.
e. Use the operations function to set the first element of the sold_items array to 5, if its value is less than 5. Do that for all objects in the Clothing_Item.
f. Print the number of Clothing_Item objects created so far.
g. Print the information of all objects of the Clothing_Item array using show_report function.
3 ) Google Define class Item which has the following private data members 1. double price represents the price of the default vabas protected data members 1 Sales item sales an object of class Sales that represents the sofantem publike data members 1. cont double cow. It represents the cost of the item. Its default value le 1. Public function 1. One constructor parameters and death it takes a value to set all the of the sold them to reprend cost any of these parametersthen to the default value 2. Getter and setter for the price 3. Getter for the item sales object. 4. vold show reportat prints the item price cost and the number of days on which it was sold Define class Clothing. Item which an item that has following private data member: 1. Intothing, stelt represents the size of the clothing item Its default valveho 2. static int countsitate too. It count the number of Clothingiem objects created so far. pubic function 1. One constructor parametered and default value to the center of the social and the of the clothes any of these were passed the value is set to the default value 2. Getter for the clothing she datama 3. Cetter for the count data mea bermaketastatinction 4 tipy.price double factor it updates the price to be the main of the price by the 5. Override the show.report function to the show reportion of the candle theme 6 Allreduction du calea Clothing Hemdeles value Hay Elefthew theme Becomes 20 In the driver program define the following 1 non-member function of the following form to do the following vold operations Clothing Item Int site IntInt sales value If the value in the sold items array in the Index (l) is smaller than the sales the replace the Terry that Index with the value that webct in the array The following example shows the sold items arrays of each Clothing item objecte celements sold Jtems co) (3,4,4,5) (3) ----> 14,3,3,7) (2) - 17.3, 0,3) If the Index 00 is 2 and the sales value 16. Then the oldes array of each Clothing lembencara hollow celements sold items O- 13,4,6,51 1-> 14,3,6,77 2 17,3,0,31 2. Write the real function to do the following .. Define an array of 4 Clothintam objects 1. Ask the user to enter sales for 7 days. These these sales in the old teray for the last object in the letter way Double the price of the second object in the Clothinglem array 4 Call duplicate MaxSales function for the last object in the Chain Mamatay . Use the operation function to the first element of the army to the face L Print the number of Clothing Item objects created so far Print the Information of all objects of the Clothing ayusing how perfection - 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 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 (parametertzed and default) that takes a value to set all the elements of the array, and the stre of the array. If any of these parameters is not passed, then default value 2. Getter for the sales stre, don't write a setter for it. 3. Getter for the sold Items array at a glven day. It recelves an Index and returns the stored value in that index in the sold items array, Assume the Index is in the proper range 4. vold set sales(int value, Int Index): It sets the recelved value in the recelved Index in the sold Items array. Assume the Index is in the proper range. 5. Int set sales/Int arr[1. Int sales_size): It coples the values in arr to the sold_Items array and then returns 1. This function works only if the passed array stre equals the sollten Otherwise, It returns-111. 3 ) Google Define class Item which has the following private data members 1. double price represents the price of the default vabas protected data members 1 Sales item sales an object of class Sales that represents the sofantem publike data members 1. cont double cow. It represents the cost of the item. Its default value le 1. Public function 1. One constructor parameters and death it takes a value to set all the of the sold them to reprend cost any of these parametersthen to the default value 2. Getter and setter for the price 3. Getter for the item sales object. 4. vold show reportat prints the item price cost and the number of days on which it was sold Define class Clothing. Item which an item that has following private data member: 1. Intothing, stelt represents the size of the clothing item Its default valveho 2. static int countsitate too. It count the number of Clothingiem objects created so far. pubic function 1. One constructor parametered and default value to the center of the social and the of the clothes any of these were passed the value is set to the default value 2. Getter for the clothing she datama 3. Cetter for the count data mea bermaketastatinction 4 tipy.price double factor it updates the price to be the main of the price by the 5. Override the show.report function to the show reportion of the candle theme 6 Allreduction du calea Clothing Hemdeles value Hay Elefthew theme Becomes 20 In the driver program define the following 1 non-member function of the following form to do the following vold operations Clothing Item Int site IntInt sales value If the value in the sold items array in the Index (l) is smaller than the sales the replace the Terry that Index with the value that webct in the array The following example shows the sold items arrays of each Clothing item objecte celements sold Jtems co) (3,4,4,5) (3) ----> 14,3,3,7) (2) - 17.3, 0,3) If the Index 00 is 2 and the sales value 16. Then the oldes array of each Clothing lembencara hollow celements sold items O- 13,4,6,51 1-> 14,3,6,77 2 17,3,0,31 2. Write the real function to do the following .. Define an array of 4 Clothintam objects 1. Ask the user to enter sales for 7 days. These these sales in the old teray for the last object in the letter way Double the price of the second object in the Clothinglem array 4 Call duplicate MaxSales function for the last object in the Chain Mamatay . Use the operation function to the first element of the army to the face L Print the number of Clothing Item objects created so far Print the Information of all objects of the Clothing ayusing how perfection - 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 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 (parametertzed and default) that takes a value to set all the elements of the array, and the stre of the array. If any of these parameters is not passed, then default value 2. Getter for the sales stre, don't write a setter for it. 3. Getter for the sold Items array at a glven day. It recelves an Index and returns the stored value in that index in the sold items array, Assume the Index is in the proper range 4. vold set sales(int value, Int Index): It sets the recelved value in the recelved Index in the sold Items array. Assume the Index is in the proper range. 5. Int set sales/Int arr[1. Int sales_size): It coples the values in arr to the sold_Items array and then returns 1. This function works only if the passed array stre equals the sollten Otherwise, It returns-111

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions