Write a program (start fresh) that draws a square (make it at least 500 pixels wide/high)....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program (start fresh) that draws a square (make it at least 500 pixels wide/high). Center the box in your screen. Inside the box, you will draw a lawn. This is not to be just a rectangular block of green. You will need to draw every blade of grass (use a pen width no greater than 3). The blade lengths should be random (choose values that will make it look "realistic"). The shade of green should also be random. You will utilize variables that change values within a loop (moving your pen for each new blade of grass), random numbers (for the grass blade length and shade of green), and other concepts from this lab and prior labs. See the example below. (View it on Blackboard to see in color.) Once this works, move on to the next part of this task. Next, add code to your program that keeps track of how many of each different length blade was drawn. For example, my random range for the grass blade length was between 15 and 23 pixels. I'm interested in knowing how many times 15 was generated, how many times 16 was generated, how many times 17 was generated, etc. This will require several variables that you set up as counters. Keep track of each length usingif/eli/else statements inside your loop. (Be careful with indentation!) Once the grass is completely done, print all of your values to the IDLE shell. Be sure to include a label. When I run mine, it appears as shown on the next page. A small snippet of code is also included as a hint. 15 pixels: 22 16 pixels: 21 17 pixels: 21 18 pixels: 24 19 pixels: 18 20 pixels: 32 21 pixels: 21 22 pixels: 24 23 pixels: 18 >>> | Write a program (start fresh) that draws a square (make it at least 500 pixels wide/high). Center the box in your screen. Inside the box, you will draw a lawn. This is not to be just a rectangular block of green. You will need to draw every blade of grass (use a pen width no greater than 3). The blade lengths should be random (choose values that will make it look "realistic"). The shade of green should also be random. You will utilize variables that change values within a loop (moving your pen for each new blade of grass), random numbers (for the grass blade length and shade of green), and other concepts from this lab and prior labs. See the example below. (View it on Blackboard to see in color.) Once this works, move on to the next part of this task. Next, add code to your program that keeps track of how many of each different length blade was drawn. For example, my random range for the grass blade length was between 15 and 23 pixels. I'm interested in knowing how many times 15 was generated, how many times 16 was generated, how many times 17 was generated, etc. This will require several variables that you set up as counters. Keep track of each length usingif/eli/else statements inside your loop. (Be careful with indentation!) Once the grass is completely done, print all of your values to the IDLE shell. Be sure to include a label. When I run mine, it appears as shown on the next page. A small snippet of code is also included as a hint. 15 pixels: 22 16 pixels: 21 17 pixels: 21 18 pixels: 24 19 pixels: 18 20 pixels: 32 21 pixels: 21 22 pixels: 24 23 pixels: 18 >>> |
Expert Answer:
Answer rating: 100% (QA)
To create a Python program that draws a square with blades of grass inside and keeps track of the di... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Consider the following information from a company's unadjusted trial balance at December 31, 2020. All accounts ha Accounts Receivable Accounts Payable Cash Service Revenue Common Stock Equipment...
-
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...
-
Businesses use budgets to plan for the future. Thats what you will be doing for this assignment. Rather than budgeting for your current financial situation, I want you to put together a budget for...
-
Estimates have been presented to Holly Farms, which is considering two environmental chambers for a project that will detail laboratory confirmations of on-line bacteria tests in chicken meat for the...
-
Revenue Recognition on Book Sales with High Returns) Uddin Publishing Co. publishes college textbooks that are sold to bookstores on the following terms. Each title has a fixed wholesale price, terms...
-
In problems use special sum formulas 1-4 to find each sum (a) (b) (c) 100 (3i-2) [(1-1)(4i + 3)] 10 k=1
-
Refer to the Arctic Springs Filtration Department Data Set. 1. Record the journal entry to transfer the cost of the 160,000 liters completed and transferred out of the Filtration Department and into...
-
Portia Carter is the president of a company that owns six multiplex movie theaters. Carter has delegated decision-making authority to the theater managers for all decisions except those relating to...
-
Factors which might cause a reduction in management's assigned penalty are called: a. Last chances. b. Second chances. c. Mitigating circumstances. d. Discharge circumstances.
-
1. What type of attitude scale is used by the ACSI if any? 2. What type of attitude study might you design if you were the consultant? 3. How would you use results from this approach to diagnose...
-
4. Often, when talking about the concept of Equal Pay critics cite statistics that indicate that women earn (approximately) $.79 for every dollar a man makes. Look into this further by looking at the...
-
Which statements about abstract classes and methods are correct? (Choose three.) A. An abstract class can be extended by a final class. B. An abstract method can be overridden by a final method. C....
-
Which of the following is a valid method name in Java? (Choose two.) A. Go_$Outside$2() B. have-Fun() C. new() D. 9enjoyTheWeather() E. $sprint() F. walk#()
-
Which statements about Java classes are true? (Choose three.) A. A Java class file may include more than one package statement. B. A Java class file may include more than one import statement. C. A...
-
What is the result of executing the Tortoise program? A. init-hare-tortoise B. init-hare C. The first line with a compiler error is line x1. D. The first line with a compiler error is line x2. E. The...
-
Given the following program, what is the first line to fail to compile? A. Line 2 B. Line 4 C. Line 5 D. Line 6 E. Line 7 F. All of the lines compile. 1: public class Electricity { 2: interface Power...
-
The Minute hand on Big Ben weights 40 lb. and is 10 ft long. ItsCG is 4 ft from the pivot. Calculate the mR product and angularlocation needed to statically balance the link. Design a...
-
Identify the tax issues or problems suggested by the following situations. State each issue as a question. Jennifer did not file a tax return for 2007 because she honestly believed that no tax was...
-
Frank, age 35, and Joyce, age 34, are married and file a joint income tax return for 2012. Their salaries for the year total $83,000 and they have taxable interest income of $4,000. They have no...
-
Ken paid the following amounts for interest during 2012: Qualified interest on home mortgage...........................................$4,700 Auto loan...
-
Clarita is a single taxpayer with two dependent children, ages 10 and 12. Clarita pays $3,000 in qualified child care expenses during the year. If her adjusted gross income (all from wages) for the...
-
Suppose that a speculative-grade bond issuer announces, just before bond markets open, that it will default on an upcoming interest payment. In the announcement, the issuer confirms various reports...
-
The expected effect on market efficiency of opening a securities market to trading by foreigners would be to: A. Decrease market efficiency. B. Leave market efficiency unchanged. C. Increase market...
-
1. An analyst estimates that a securitys intrinsic value is lower than its market value. The security appears to be: A. Undervalued. B. Fairly valued. C. Overvalued. 2. A market in which assets...
Study smarter with the SolutionInn App