Gene's Green Golf Center is remodeling their golf course, and has hired you to help determine what will be needed to complete the project. There are 18 holes on the golf course, but Gene is not very...


Gene's Green Golf Center is remodeling their golf course, and has hired you to help determine what will be needed to complete the project. There are 18 holes on the golf course, but Gene is not very creative, so every hole looks similar to this, only the length and width change:





Diagram of one hole of golf course.  The area is rectangular, bordered by bushes except for an entry trail to the tee-off area.  The tee-off area and hole area are circular areas of smooth green grass.  There is a circular sand trap near the hole area.  The sand trap is bordered on half of the circle by a brick retaining wall.  The rest of the course area is covered by rough sod.



Gene would like you to design and implement a small program that calculates the following information for a course hole and generates a well-formatted report.



  1. Total square yards of rough sod, rounded up to nearest square yard.

  2. Total square yards of smooth green sod, rounded up to nearest square yard.

  3. Tons of sand needed for the sand trap (US Tons), rounded up to nearest ton.

  4. Number of bricks needed for the retaining wall, rounded up to nearest brick.

  5. Number of bushes needed, rounded down to nearest bush.

  6. How long the given hole will take to mow each week in minutes, rounded up to nearest minute.



Here is some informationyou may need:



  1. Gene will provide the length and width of the hole in yards. Your program should ask for this information in that order (length followed by width). Your program should expect a float type number for these quantities. This should be the only inputs needed to generate the report.

  2. The hole green and the tee-off green areas each are circles with a diameter of half of the course width.

  3. The sand trap is a circle with a diameter of one-third of the width of the course width.

  4. The sand trap is 1 foot deep.

  5. Sand weighs 100 lbs. per cubic foot.

  6. The brick retaining wall is one brick deep and 3 bricks tall. It covers half of the circumference of the sand trap. Each brick is 12 inches long.

  7. The course is surrounded on all sides by bushes. Gene wants to plant 1 bush for every yard of the course perimeter, leaving 2 spots empty for the entry and exit trails.

  8. It takes 0.5 seconds to mow the grass of each square yard of rough green sod (it's a very large, fast mower!). It takes double this time for the smooth green, because the mower makes 2 passes to make it very even. The area covered by the bushes should be included in the mowing time calculation. The area covered by the sand trap should be excluded from the mowing time. You can ignore the contribution of the retaining wall and entry/exit trails.



For example, with the following inputs:



Enter Course Length: 20 Enter Course Width: 10


the output should look exactly like this:



Total square yards of rough sod: 152 Total square yards of smooth sod: 40 Tons of sand: 4 Number of retaining wall bricks: 48 Number of bushes: 58 Total Mowing Time (mins): 2

Note that because floating point values often incur rounding errors, the output might not be completely accurate. This will not affect the grading. However, please make your outputs look like the example above, so that the automated system can evaluate your results.



Your program must:



  1. Take console input from the user in the form of the course length followed by the course width.

  2. Define at least 4 new functions to accomplish this task.



Things to think about when you’re designing and writing this program:



  1. Identify the things the program will need to do, like calculate the total square yards of rough sod, and calculate the total square yards of smooth sod, etc. Then design and write a function for each of these things the program must do.

  2. For each function your design and write, make sure that function does only one thing. For example, you may design and write a function to calculate the total square yards of rough sod, calculating the total square yards of rough sod is one thing. This functionshould notalso do a second thing, likedisplaythe total square yards of rough sod.

  3. For each function that you design and write, give that function a name that clearly describes what that function does. For example, a function that calculates the total square yards of rough sod, may be namedcalculate_sq_yrds_rough_sod.

  4. For each function that you design and write, ask yourself "What things does this function need to know in order to be able to do what this function should do?" Take, for example, a function that will calculate the total square yards of rough sod. What things does this function need to know in order to be able to calculate the total square yards of rough sod? This function will need to know the length and the width of the course. The things the function needs to know should be passed to the function as arguments, so the function will need some parameter variables to store these argument values that are passed to it. Some functions may not need to know anything in order to do what they should do, but those that do should take arguments. In general, avoid the use of global variables.

  5. For each function that you design and write, ask yourself "what do I need to get back from this function?". For example, what do I need to get back from thecalculate_sq_yrds_rough_sod.function? I need the function to give me the number of square yards of rough sod required for this hole. Since this function must give something back when it is called, the function should use areturnstatement to return that value.

  6. Follow this recipe to organize your code: (1) define your functions, (2) collect all your input (3) calculate the required results (4) output the results.

  7. Spend some time choosing your variable names carefully. Names should be descriptive.

  8. Take advantage of variables to name values whose purpose may not be obvious.

  9. Take advantage of variables by breaking any complex expressions down into a set of simpler expressions and storing the intermediate results in variables.

Mar 31, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here