Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Assignment: Functions

Using Processing, write a single program containing definitions for all the functions described below. Make sure to put a comment above each function definition with a description of the function, each parameter's purpose, and the return value's purpose (if there is a return value at all). Use rgb color mode!

Define the following three functions:

1) A function named howBright. It should compute the visual brightness of a given rgb color, specified by three parameters for the red blue and green components. The function should return the computed brightness value as a float.

Hint: The brightness of an rgb color is the arithmetic mean (average) of the three component values. So, add them up and divide by three.

2) A function named drawCar. This function should draw an automobile roughly 100 by 100 pixels in size centered at the x,y coordinates given by the first two float parameters. Three more float parameters specify the rgb components of the primary paint color, and the last three float parameters specify the rgb components of the trim color. Use at least 8 shapes to make the car. This function need not return any value.

Hint: You'll need 8 float parameters: two for location, then three for paint color components, then three for trim color components.

3) A setup function that makes two cars appear in the display window on a stationary roadway: one car in the middle of the left half of the screen, and the other car in the middle of the right half of the screen. The left car should have totally random colors for the primary paint color and for the trim color. The right car should be a grayscale car with paint and trim the same brightness as the left car. You must invoke your drawCar function once to make each car, and you must invoke howBright to determine the colors for the right car.

Hint: Choose 6 random color components, store them into 6 variables, compute the brightnesses of those two rgb colors, and store those into two more variables. Invoke drawCar on the left with the 6 color variables. Invoke drawcar on the right with the brightness variables, provided three times each as three-component grayscale colors.

Note that this is not an animation, because there is no draw function defined.

Remember to put a header comment at the top of your code: name, date, class, assignment, and a description.Also put comments above each function definition describing what the function does, its parameters (if any), and its return value (if any).

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92752900

Have any Question?


Related Questions in Computer Engineering

Restaurant management database project the restaurant

Restaurant Management Database Project : The restaurant maintains the catalog for the list of food and beverage items that it provides. Apart from providing food facility at their own premises, the restaurant takes order ...

Question 1 what is rdbms2 what is key-value pair

Question: 1. What is RDBMS? 2. What is Key-Value Pair Databases? 3. What are the foundational behaviors of MapReduce? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

A small factory produces two types of toys trucks and

A small factory produces two types of toys: trucks and bicycles. In the manufacturing process two machines are used: the piece maker and the assembler. It takes 2 hours to make the pieces of the bicycles and 1 hour for t ...

What statistic was calculated to determine differences

What statistic was calculated to determine differences between the intervention and control groups for the lumbar and femur neck BMDs? Were the groups significantly different for BMDs?

Question lessons learned from the mirai botnet attack of

Question: Lessons learned from the Mirai Botnet attack of 2016 • Why was it so much more effective than previous BotNet designs? • What kind of mitigations would you recommend for protection? These two points must be ans ...

Question there are a number of key steps necessary to

Question: There are a number of key steps necessary to effectively handle an incident. Please briefly describe the basic activities in the incident response procedure . Choose two activities in the basic activities in th ...

Assume that the hypothetical economy of mo has 8 workers in

Assume that the hypothetical economy of Mo has 8 workers in year 1, each working 1,500 hours per year (50 weeks at 30 hours per week). The total input of labor is 12,000 hours. Productivity (average real output per hour ...

Identify at least two 2 factors that have led to the

Identify at least two (2) factors that have led to the explosive growth of digital crime over the past a few decades. Next, describe the most common forms of digital crime, and give your opinion as to why those forms you ...

Given the following three months of data what is the

Given the following three months of data what is the coefficient of variation? t, R_t 1, 21.01% 2, -13.83% 3, 15.67% 4, 0.88% 5, -1.32% Express your answer in total return decimal format.

Run sqlplus systemoracle11 and spool to ccis421bs6spooltxt

Run sqlplus system/Oracle11 and SPOOL to c:\cis421b\S6spool.txt User SCOTT, who had the password TIGER, changed it to something more secure, but has since forgotten it. If possible, demonstrate what you as a DBA can do t ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As