For this problem, you'll write a program to draw a simple picture of a car. It...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
For this problem, you'll write a program to draw a simple picture of a car. It will look something like this: Figure 2: A sample car with (r. g. b) values of (255, 0.0) for the color of the car's body paint Getting the right visual output for this problem is pretty easy. Our real goal is to practice writing function definitions and using function calls and function arguments and parameters correctly. For this reason, you are required to break up your program into the following functions - draw_hody (r, g, b) draws the body of the car, including the front window. The values r. g. and bare parameters to this function. Use these parameters to set the color of the car's body. The color of the window however should always be blue • draw_wheel (x, y) draws just one wheel of the car. A wheel consists of a black outer tire and a white hubcap. The values x andy are parameters to this function that indicate the x y) location coordinates of the center of the wheel. - draw_car (r, g, b) draws the entire car by making function calls to the functions above. The values r. g. and b represent the color components of the car's body, these should be pased along as argu- ments to the draw.body0 function. Note that draw_wheel will have to be called twice (with different arguments) to draw both wheels! Each of the functions above must be documented with a docstring that describes what the function does and the meaning of its parameters. A small number of single-line comments should also be used where appropriate throughout the program. The very last line of your program should be a function call to draw_car (), where the colour values for the car's body are passed in as arguments. For example, a call of draw_car (255, 0, 0) should produce the car seen in the sample here, whereas a call of dras_car (0, 0, 0, 0) would produce a black car. This should be the ONLY place in your code where you specify actual numbers for the color of the car. You may wish to include code to adjust the size and background color of the Processing canvas at this point as well We confess it the sample car above looks pretty boring. You are free to add more cosmetic details to the drawing if you like (for example, a headlight, a tailpipe, racing stripes, etc.), so long as you are still meeting the criteria outlined above. For this problem, you'll write a program to draw a simple picture of a car. It will look something like this: Figure 2: A sample car with (r. g. b) values of (255, 0.0) for the color of the car's body paint Getting the right visual output for this problem is pretty easy. Our real goal is to practice writing function definitions and using function calls and function arguments and parameters correctly. For this reason, you are required to break up your program into the following functions - draw_hody (r, g, b) draws the body of the car, including the front window. The values r. g. and bare parameters to this function. Use these parameters to set the color of the car's body. The color of the window however should always be blue • draw_wheel (x, y) draws just one wheel of the car. A wheel consists of a black outer tire and a white hubcap. The values x andy are parameters to this function that indicate the x y) location coordinates of the center of the wheel. - draw_car (r, g, b) draws the entire car by making function calls to the functions above. The values r. g. and b represent the color components of the car's body, these should be pased along as argu- ments to the draw.body0 function. Note that draw_wheel will have to be called twice (with different arguments) to draw both wheels! Each of the functions above must be documented with a docstring that describes what the function does and the meaning of its parameters. A small number of single-line comments should also be used where appropriate throughout the program. The very last line of your program should be a function call to draw_car (), where the colour values for the car's body are passed in as arguments. For example, a call of draw_car (255, 0, 0) should produce the car seen in the sample here, whereas a call of dras_car (0, 0, 0, 0) would produce a black car. This should be the ONLY place in your code where you specify actual numbers for the color of the car. You may wish to include code to adjust the size and background color of the Processing canvas at this point as well We confess it the sample car above looks pretty boring. You are free to add more cosmetic details to the drawing if you like (for example, a headlight, a tailpipe, racing stripes, etc.), so long as you are still meeting the criteria outlined above.
Expert 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
-
Of all the book fines a library issued one year, 0.8% of them were for amounts greater than $10. There were 15 fines greater than $10. How many fines did the library issue that year? Enter your...
-
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...
-
Can technological advancements and digital divides exacerbate existing disparities in access to information, education, and employment opportunities, thereby reinforcing social stratification?
-
Identify the implied strategies that correspond with the Department of Veterans Affairs Healthcare System High Matrix Score on SWOT quadran that they might look like at your HSO. Also explain why...
-
Make a control volume around the whole power plant in Figure 1.2 and with the help of Fig. 1.1 list what flows of mass and energy are in or out and any storage of energy. Make Sure you know what is...
-
Tristan Narvaja, S.A., is the Uruguayan subsidiary of a U.S. manufacturing company. Its balance sheet for January 1 follows. The January 1st exchange rate between the U.S. dollar and the peso...
-
A six cylinder, four-stroke, spark ignition engine of bore \(10 \mathrm{~cm}\) and stroke \(12 \mathrm{~cm}\) with a compression ratio of 6 is tested at \(4800 \mathrm{rpm}\) on a dynamometer of arm...
-
Susquehanna Medical Center operates a general hospital in northeastern Pennsylvania. The medical center also rents space and beds to separately owned entities rendering specialized services, such as...
-
1. Write a program in python to get the number of rows using GUI. If the user entered less than 4 rows, display the message not to enter less than 4 rows and allow the user to enter again. For...
-
Angus Walker, CFA, is reviewing the defined benefit pension plan of Acme Industries. Based in London, Acme has operations in North America, Japan, and several European countries. Next month, the...
-
Valley Production (VP) manufactures two types of chemicals. One is the Potassium Chloride-Pharmacological grade (KCL-P) and the other is the Potassium Chloride-Technical grade (KCL-T). The accounting...
-
You are tasked with the valuation of Roosevelt Labs. In 2021, Roosevelt had sales of $506 million, earnings of $38 million, EBITDA of $57.5 million, excess cash of $100 million, $4.2 million of debt,...
-
Using the artcle below, how can the Business Relationship Manager role assist with change management in an organization? How might change management activities align with the drivers of relationship...
-
Customers of a phone company can choose between two service plans for long distance calls. The first plan has no monthly fee but charges $0.12 for each minute of calls. The second plan has a $20...
-
Brangelina Adoption Agency's general ledger shows a cash balance of $11,701. The balance of cash in the March-end bank statement is $7,349. A review of the bank statement reveals the following...
-
Reduce the matrix [AT] in order to determine if A is invertible. Compute A when A is invertible and check that AA = I. Verify that the (1, 1)-entry in the product A-A is 1. 1. 4. 7. 2 5 3 1 2 3 135...
-
2. 6 points Consider the vectors = -1 and = H 5 5 (a) Find the matrix of the orthogonal projection onto the line L in R spanned by u.
-
Does log 81 (2401) = log 3 (7)? Verify the claim algebraically.
-
The following additional information is available for the Dr. Ivan and Irene Incisor family. Ivan and Irene have the following investment income, in addition to that reported in Chapter 1: Dividends...
-
Professor Patricia (Patty) Pate is retired from the PalmSprings Culinary Arts Academy (PSCAA). She is a single taxpayer and is 68 years old. Patty lives at 98 Colander Street, Henderson, NV 89052....
-
Greg died on July 1, 2012, and left Lea, his wife, a $50,000 life insurance policy which she elects to receive at $5,000 per year plus interest for 10 years. In the current year, Lea receives $6,200....
-
Vertical analysis would rarely be performed on which of the following statements or schedules? a. Income statement b. Adjusting entry worksheet c. Balance sheet d. All of the above are common targets...
-
A statement that lists the assets, liabilities, and stockholders equity of a company in percentages only with no dollar amounts is a a. common-size income statement. b. benchmarking analysis. c....
-
In vertical analysis, the base used for comparison on the income statement is a. total expenses. b. total assets. c. net sales. d. gross profit.
Study smarter with the SolutionInn App