Program to select fruits from constructor stored in array


Question 1) Write a program that does the following:

A farm delivers the box of fresh fruits and vegetables to your house once a week. For this assignment, define a class BoxOfProduce which contains exactly three bundles of fruits or vegetables. You could represent fruits or vegetables as the array of type string. Add suitable constructors and accessor/mutator functions to get or set fruits or vegetables stored in array. Also write the output function which displays complete contents of the box on the console.

Next, write a main function which creates a BoxOfProduce with three items randomly selected from this list:

Broccoli
Tomato
Kiwi
Kale
Tomatillo

Don’t worry if your program randomly chooses duplicate produce for the three items. Next, main function must display contents of box and allow the user to substitute any one of the possible fruits or vegetables for any of the fruits or vegetables selected for the box. After the user is done with substitutions it must output the final contents of the box to be delivered. Then it must ask if user wants to create another box and if yes, it must repeat the above steps. It must keep doing so until user selects not to create another box of produce.

At last, add the static variable to your class which keeps track of the total number of boxes of produce created and a static function that returns that value. Display this value in main function at the end of each iteration of the main loop.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Program to select fruits from constructor stored in array
Reference No:- TGS04655

Expected delivery within 24 Hours