Question
Complete the program below in order to recreate this drawing of a fancy hat. The hat is made from a black rectangle and a black
Complete the program below in order to recreate this drawing of a fancy hat.
The hat is made from a black rectangle and a black square.
- The black body of the hat is a square that is 280 pixels wide.
- The black brim of the hat is a rectangle that is 400 pixels wide and 80 pixels high.
The red feather is a triangle that is 60 pixels high and twice as wide. Its lower left point lies on the top edge of the brim, centered on the brim horizontally.
The green button is a circle that is 50 pixels in diameter. It is centered both horizontally and vertically on the square body of the hat.
There are two lines of decorative green stitching. These lines are thicker than the Processing default: you can choose the thickness. The length of each line is 2 times the diameter of the button. The lines are centered horizontally on the square body of the hat. In the vertical direction, each line is shifted from the center of the square by a distance equal to the diameter of the button.
The hat is centered horizontally on the canvas. The distance from the top of the canvas to the top of the hat is the same as the height of the brim.
Fill in each ________ with the correct value and also add the code you need to draw the picture. Use a 500 by 500 canvas as set up below, and use the given value of BKGD_COLOR to set the background color.
Your solution must use good coding practices, and it must use the five constants defined below. Do not use any magic numbers!
final int BODY_SIZE = ________; // width of black square final int BRIM_WIDTH = ________; // width of black rectangle final int BRIM_HEIGHT = ________; // height of black rectangle final int FEATHER_HEIGHT = ________; // height of red triangle final int BUTTON_SIZE = ________; // diameter of green circle
final int BKGD_COLOR = #F2FEFF;
size(500,500);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started