Ask Computer Engineering Expert

Assignment

Task 1

1) Write a method that draws a square such that the center of the square is the location of the mouse. This method does not need to take any inputs.

2) Write a method that takes an (x,y) position, and draws a pair of circles at that location: one smaller and the other larger, like this:

2054_Pair of Circle.jpg

3) Write a method that takes three ints: x, y, and c. It should then draw a rectangle at the location (x,y), that is a shade of grey based on c. If c is 0 it should be completely black, if c is 255 it should be completely white.

Task 2

1) Write a method that takes an (x,y) position, and draws a smiley face centered on that position. You may find the arc() method useful, but you can make the smiley face out of rectangles, ellipses, and lines if you want. It doesn't need to look great.

2) Write a method that takes four ints: x1, y1, x2, y2. It should then draw a rectangle with the top-left corner at (x1,y1), and the bottom right corner at (x2,y2). You can assume that (x2,y2) will always be down and to the right of (x1,y1).

3) Write a method that takes a float, w, and draws a pair of lines that cross at the location of the cursor. w is the total horizontal width of the X-shape that they make.

4) Write a method that takes 6 floats: x1,y1,x2,y2,x3,y3. It should then use the line() method to draw the three edges of a triangle that has corners at (x1,y1), (x2,y2), and (x3,y3). (It's interesting to note that this is basically the same as the triangle() method that is built into processing, except that you won't be adding the fill.)

Task 3

1) Write a method that takes 5 floats: x1, y1, x2, y2, and fraction. Assuming fraction is between 0 and 1, it should draw a circle centered that fraction of the way between (x1, y1) and (x2, y2). In other words, if fraction is 0, it should draw a circle at (x1, y1). If fraction is 1, it should draw a circle at (x2, y2). If fraction is 0.25, it should draw a circle one quarter of the way along an imaginary line that goes from (x1, y1) to (x2, y2). (Hint: the x position of the circle will only depend on the x values and fraction, so you might first start by thinking about it on just the x axis. This problem is fairly math- heavy.)

2) Write a method, pastel(), that takes 3 ints: r, g, and b, and sets the fill to a pastel version of that color. (A pastel color is simply a pale color. It might be worth playing around in the color selector or a drawing program to look for patterns in the r,g,b values of pale colors.) For example, pastel(255,0,0) should set the fill to pink, and pastel(0,255,255) should set the fill to light teal. It should not set the fill to completely white unless given values extremely close to 255. Write a second method colorNeg(), that takes 3 ints: r, g, and b, and sets the fill to the negative of that color. For example, colorNeg(0,0,0) should set the fill to white, and colorNeg(0,255,0) should set the fill to magenta.

1) Write a method that takes 6 integers: x1, y1, x2, y2, x3, y3. It should then draw three ellipses centered at those locations. It should always draw them so that ellipses further up and left are drawn on top. For example, you could draw the following set of circles with this method:

1650_Three Ellipses Centered.jpg

But not the same circles with the rightmost one on top. The leftmost circle is drawn on top of the one in the middle even though it's further down, because it's further left than it is down.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92210638
  • Price:- $50

Priced at Now at $50, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

Jeff decides to start saving some money from this upcoming

Jeff decides to start saving some money from this upcoming month onwards. He decides to save only $500 at first, but each month he will increase the amount invested by $100. He will do it for 60 months (including the fir ...

Suppose you make 30 annual investments in a fund that pays

Suppose you make 30 annual investments in a fund that pays 6% compounded annually. If your first deposit is $7,500 and each successive deposit is 6% greater than the preceding deposit, how much will be in the fund immedi ...

Question -under what circumstances is it ethical if ever to

Question :- Under what circumstances is it ethical, if ever, to use consumer information in marketing research? Explain why you consider it ethical or unethical.

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks,

Among the who imf and wto which of these governmental

Among the WHO, IMF, and WTO, which of these governmental institutions do you feel has most profoundly shaped healthcare outcomes in low-income countries and why? Please support your reasons with examples and research/doc ...

A real estate developer will build two different types of

A real estate developer will build two different types of apartments in a residential area: one- bedroom apartments and two-bedroom apartments. In addition, the developer will build either a swimming pool or a tennis cou ...

Question what some of the reasons that evolutionary models

Question : What some of the reasons that evolutionary models are considered by many to be the best approach to software development. The response must be typed, single spaced, must be in times new roman font (size 12) an ...

  • 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