Write single program containing definitions for all function

Assignment Help Computer Engineering
Reference no: EM131914236

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).

Reference no: EM131914236

Questions Cloud

Let a and b be events with p : Let A and B be events with P(A)=0.82 and P(B)=0.54 and P (A I B)=0.52. Find P (A and B)
What would total number of shares outstanding : The lucy Toy Company currently has 5,000 share of outstanding stock, What would the total number of shares outstanding be after d?
Confidence interval estimate for the population proportion : Construct a 90?% confidence interval estimate for the population proportion of travelers who said that location was very important for choosing a hotel.
What is the additional year-three cash flow : What is the additional Year-3 cash flow (i.e, the after-tax salvage and the return of working capital)?
Write single program containing definitions for all function : write a single program containing definitions for all the functions described below. Make sure to put a comment above each function definition.
Assess riskfactors for obesity : A study is conducted in 100 children to assess riskfactors for obesity.Children are enrolled and undergo a complete physical examination.
Explain why it is important for organizations like the case : Give examples of internal and external stakeholders and where do you fit them in the stakeholder's matrix? Be thoughtful.
Write research proposal on an IT prototype system : Task: Applying IT R&D Methodology - Write a short research proposal (500 words) on an IT prototype system to solving one the problems
Estimate for the population proportion of travelers : Construct a 95?% confidence interval estimate for the population proportion of travelers who said that location was very important for choosing a hotel.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd