planning my vegetable garden for next year. I have a number of varieties of tomatoes, eggplants,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
Here is a Python solution for the problem def plantgardenplantnames plantnums maxplants plantchoices ... View the full answer
Related Book For
Data Analysis and Decision Making
ISBN: 978-0538476126
4th edition
Authors: Christian Albright, Wayne Winston, Christopher Zappe
Posted Date:
Students also viewed these programming questions
-
Slapshot Company makes ice hockey sticks and sold 16,000 sticks during the month of June at a total cost of $431,000. Each stick sold at a price of $90. Slapshot also incurred two types of selling...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Assignment 5: Hash Table implementation andconcordance There are three parts to this assignment. In the first two parts,you will complete the implementation of a hash map and aconcordance program. In...
-
The following are selected 2023 transactions of Ayayai Corporation. Sept. 1 Oct. 1 1 Purchased inventory from Indigo Ltd. on account for $47,200. Ayayai uses a periodic inventory system. Issued a...
-
At a few places where the air is very cold in the winter, like 30oC it is possible to find a temperature of 13oC down below ground. What efficiency will a heat engine have operating between these two...
-
The file MarketPenetration contains the market penetration value (i.e., the percentage of the country population that are users) for the 15 countries that lead the world in total number of Facebook...
-
Indicate the audit procedure(s) you would use to verify each of the following items. Briefly explain each procedure, indicating how it would be applied in the particular situation. (i) Value of...
-
Grant Company purchased the net assets of Harding Company on January 1, 2015, and made the following entry to record the purchase: Provide the correct title for the $40,000 credit account above and...
-
What is performance management systems? Do the companies where you (or others you know) have worked used performance management systems rather than performance appraisal systems? If yes, what kind of...
-
Singleton Supplies Corporation (SSC) manufactures medical products for hospitals, clinics, and nursing homes. SSC may introduce a new type of X-ray scanner designed to identify certain types of...
-
1) Suppose the government decided to change the capital gains inclusion rate from 50% to 75%. Evaluate this decision in light of the qualitative characteristics of tax systems. What are your thoughts...
-
'The fiscal and monetary authorities in the US have overreacted to the Covid-19 crisis; there is now excessive stimulus, both fiscal and monetary, in the US economy and this is bound to cause...
-
In this part, your goal is to derive the transfer function representation for the rotational mechanical system composed of two inertias Um and JL) and a damper (B) shown on the right. The input of...
-
If the risk rate of the return is 4%, the return on the market portfolio is 12%, the beta of the hotel norwood is 1.5, what is the expected rate of the return for hotel norwood?
-
10 cumecs of water is delivered to a 32 ha field for 4 hr. Calculate water application efficiency, if the depth of water stored in the root zone is 0.3 m.
-
An investor with 2,500 to invest believes that Hanson stock will increase in value but is undecided whether to purchase Hanson stock, whether to purchase call options to purchase Hanson stock, or...
-
How significant are supply and demand?
-
Refer to the data in QS 10-1. Based on financial considerations alone, should Helix accept this order at the special price? Explain.
-
You now have $10,000, all of which is invested in a sports team. Each year there is a 60% chance that the value of the team will increase by 60% and a 40% chance that the value of the team will...
-
The Ventron Engineering Company has just been awarded a $2 million development contract by the U.S. Army Aviation Systems Command to develop a blade spar for its Heavy Lift Helicopter program. The...
-
The file DJIA Monthly Close.xlsx contains monthly values of the Dow Jones Industrial Average from1950 through 2009. It also contains the percentage changes from month to month. Create a new column...
-
Browne Cleaning and Gardening Services commenced on 1 June 2026 when Lorne Browne contributed \($120\) 000 into a business bank account. Perhaps more thought could have been given to the business...
-
A proton, a deuteron (a hydrogen nucleus containing one proton and one neutron), and an alpha particle (a helium nucleus consisting of two protons and two neutrons) initially at rest are all...
-
Identical positively charged objects \(A, B\), and \(C\) are launched with the same initial speed from the same position above a negatively charged sheet that produces a uniform electric field. The...
Study smarter with the SolutionInn App