Question 2: Sculpture Garden (85 points) The Redpath Museum is planning a sculpture garden on the grounds
Question:
Question 2: Sculpture Garden (85 points) The Redpath Museum is planning a sculpture garden on the grounds of a large field on the West Island. (This is not actually true, but let us go along with it for the purposes of this question.) There will be a certain number of sculptures arranged in a grid formation. Each sculpture will be enclosed by a fence. The Museum is currently deciding how many sculptures to display in the garden, and how large a plot of land should be allocated for the garden, given that there should be a certain amount of space between each sculpture. In this question, we will write some code to help the Museum with these decisions. For the purposes of this assignment, we will assume that the plot of land can have any size. Let us also assume that the Museum has many sub-basement levels where an infinite number of sculptures are stored, so neither plot size nor number of sculptures are bounded. We will use the terms ‘plot’ and ‘subplot’ below. Plot refers to the total area of land for the sculpture garden. The plot will be rectangular and have a width and height (in metres). A subplot is a fenceenclosed rectangular area for a specific sculpture. Each subplot will have the same width and height. A plot can contain many subplots, depending on the size of the plot and the size of a subplot. Our code will perform two tasks. One is to calculate the cost of the sculpture garden, given the size of a plot of land, the size of each sculpture’s subplot, the spacing between each sculpture’s subplot, and the fencing and gravel needed for each subplot. The other task will be to calculate how many sculptures could fit into a garden of a certain size, given a maximum budget. There will be a few different calculations, and each will be placed in its own function. Whenever you are faced with a complex problem, which will most often be the case when programming, it is best to break it down into smaller sub-parts. Each different computation should be put into its own function. This organizational paradigm serves three purposes. First, it makes your code file much easier to read through and navigate. Secondly, and most importantly, it lets you focus on one thing at a time. Finally, it helps with testing. Each time you write a function, you should always test it thoroughly, giving it different inputs and checking that the output is what you expect it to be. It is easier to test functions when they are small and do not do too much on their own. Only once you are certain that a function is working properly, then you can move onto the next function. Functions also help in code re-use. By putting some computation into a function, if we then needed to perform the same computation again, we can just call that same function instead of copy-and-pasting the code to a different location. Copy-and-pasting large blocks of code is bad in programming! One of the keys of programming is don’t repeat yourself (‘DRY’). Whenever you have repeated several lines of code, ask yourself if there is a way to simplify the code by putting it into a function instead (and then just calling it when needed). We will also be checking your code to make sure that not too much code is repeated throughout your file. This question will specify exactly which functions you will have to write, and thus, will help to show you how a big problem can be broken down into smaller sub-parts. Keeping the above in mind, we can start writing our code for the assignment. First, create a file garden.py and define the following global variables at the top of your file. You will use these variables in certain functions of your code.
Project management the managerial process
ISBN: 978-0073403342
5th edition
Authors: Eric W Larson, Clifford F. Gray