Question: planning my vegetable garden for next year. I have a number of varieties of tomatoes, eggplants, and peppers, but only so much room. You

planning my vegetable garden for next year. I have a number of varieties of tomatoes, eggplants, and peppers, 

planning my vegetable garden for next year. I have a number of varieties of tomatoes, eggplants, and peppers, but only so much room. You are given: plant_names, a string array with the names of the varieties plant_nums, a numerical array with the number of seeds there are for each variety max_plants, a randomized integer with the number of spaces available in the garden. You will create a string array, plant_choices, that contains the names of the varieties that are going to be planted. Decide what to plant based on the following algorithm: Establish initial conditions: start at the index of the first plant and first position of plant_choices Check: have you reached the total number of allowable seeds planted (max_plants) and do you have seeds (of any plant type) remaining? If yes: Check: Do you have any more seeds for the selected plant type? If yes: Add the name of the plant type to plant_choices, remove 1 seed from plant_nums for that specific plant type, remove 1 from max_plants, and index the position of plant_choices by 1. If no: Check: Have you reached the end of the list of plants? If yes: Reset the index of the plant type to 1 If no: Add 1 to index of the type of plant If no: end the loop

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is a Python solution for the problem def plantgardenplantnames plantnums maxplants plantchoices ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!