Question: Python project Project 1 Garden Bed Objective: The goal of this project is to gain experience with mathematical manipulation of numeric values. Description: Programs are

Python project

Project 1 Garden Bed Objective: The goal of this project is to gain experience with mathematical manipulation of numeric values. Description: Programs are good at performing routine mathematical calculations. By way of illustration, you will write a program to calculate the materials needed for an ornamental garden according to the design below. In this design, the blue areas represent flowerbeds and the yellow areas are filled with stone, mulch, or other fill material. The garden is a perfect square. The four outer flowerbeds are congruent semicircles and the central flowerbed is a perfect circle. Project Description / Specification Your program should prompt the user for the following information: 1. The side length (in feet) of the finished garden. 2. The recommended spacing (in feet) between plants. 3. The depth (in feet) of the flowerbeds. 4. The depth (in feet) of the filled areas. Next estimate the number of plants and the amount of fill and flowerbed soil needed. Finally, it should report the following quantities needed for the garden: 1. Number of plants for each type of flowerbed (semicircle and circle) and total number of plants for the garden. 2. Cubic yards of soil for each type of flowerbed (semicircle and circle) and total cubic yards of soil for the garden, rounded to one decimal place. 3. Total cubic yards of fill material for the garden, rounded to one decimal place. Assignment Overview This assignment will give you experience on the use of: 1. Integers and floats 2. Mathematical operations 3. The float(), int(), round(), print(), and input()functions 4. Importing a Python module Program Details: To clarify the problem specifications, we provide at the end of this document a snapshot of interaction with the already written program. The formula for the area A of a circle is A = r2, where r denotes the radius. For this calculation, you should use the value of provided in the Python math module. After importing the math module, the name math.pi returns (a close approximation to) the value of . (See comments in example_numeric.py.) To estimate the number of plants for a flowerbed, divide the area of the flowerbed by the area needed per plant (the square of the recommended distance between plants) and then truncate this result. To truncate a float, convert it to an int using the int function which implicitly truncates the float (see comments in example_numeric.py) or use the math.trunc()function. Be careful, the number of plants in a semicircle may not be exactly half of the plants in a full circle. Look at the program example_numeric.py in the proj01 directory as an example (with explanations in the comments) of the Python features you will use in this program. Assume that the user only inputs numbers, that is, you dont need to do error checking for bad input. Remember to convert fill to cubic yards. Getting Started: If you sit down and try to implement the entire project in one-shot, it may seem over-whelming. It is important to break down the implementation into small manageable pieces and get each piece working correctly before starting on the next one. As you get more comfortable with programming, youll naturally start to see how to break apart the projects into small pieces. Below, Ive suggested a possible sequence of steps you could take to implement your project. Feel free to use your own sequence if you prefer: Here is an outline of your program: 1. Prompt for input (use input) 2. Convert the input strings to numbers (use float) 3. Do some mathematical calculations using the input numbers to get results. 4. Print the results (use print) You should run and thoroughly test your code after each step. It is MUCH easier to find 1 error in 5 new lines of code than it is to find 10 errors in 50 lines of code. Project Requirements: You must follow all of the good programming practices discussed in class: Comment your code thoroughly. Indent your code appropriately. Use meaningful variable names. Provide the user with understandable prompts and instructions. Make sure your name is included in comments at the top of your code. If this is not done, points will be deducted from your program and it will be impossible to earn an A. Submission: Using the Canvas assignment feature, you should submit the source code (.cpp file). Make sure you click to submit your assignment after uploading the file attachment! Questions for you to consider (not hand in) 1. What happens when the user enters a letter instead of a number at the prompt? 2. What are two ways to get the program to crash (produce an error instead of printing output)? 3. Can you find inputs for which the number of plants required for the center circular flowerbed is not twice that required for a semi-circular bed? Sample Interactions: Calculate Garden requirements ----------------------------- Enter length of side of garden (feet): 10 Enter spacing between plants (feet): 0.5 Enter depth of garden soil (feet): 0.8333 Enter depth of fill (feet): 0.8333 ----------------------------- Requirements Plants for each semicircle garden: 39 Plants for the circle garden: 78 Total plants for garden: 234 Soil for each semicircle garden: 0.3 cubic yards Soil for the circle garden: 0.6 cubic yards Total soil for the garden: 1.8 cubic yards Total fill for the garden: 1.3 cubic yards

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!