Your community supported agriculture csa farm delivers a


Question: Your Community Supported Agriculture (CSA) farm delivers a box of fresh fruits and vegetables to your house once a week. For this Programming Project, define the class Box Of Produce that contains exactly three bundles of fruits or vegetables. You can represent the fruits or vegetables as three instance variables of type String. Add an appropriate constructor, accessor, and mutator methods. Also write a to String () method that returns as a String the complete contents of the box. Next, write a main method that creates a Box Of Produce with three items randomly selected from this list:

Broccoli

Tomato

Kiwi

Kale

Tomatillo

This list should be stored in a text file that is read in by your program. For now you can assume that the list contains exactly five types of fruits or vegetables. Do not worry if your program randomly selects duplicate produce for the three items. Next, the main method should display the contents of the box and allow the user to substitute any one of the five possible fruits or vegetables for any of the fruits or vegetables selected for the box. After the user is done with substitutions, output the final contents of the box to be delivered. If you create additional methods to select the random items and to select valid substitutions, then your main method will be simpler to write.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Your community supported agriculture csa farm delivers a
Reference No:- TGS02404405

Now Priced at $15 (50% Discount)

Recommended (93%)

Rated (4.5/5)