Question: Create a cityscape using functions and parameters!To do this, you need to write a function called drawBuilding ( ) that draws a ( rectangle )

Create a cityscape using functions and parameters!To do this, you need to write a function called drawBuilding() that draws a (rectangle) building. This function should take as parameters the width of the building, the height of the building, and the x-position of the building (remember where rectangles positions are anchored!).drawBuilding(buildingWidth, buildingHeight, buildingX);JavaScriptYou also need to define a drawLightPole() function that is called when the building is taller than 200, as stored in LIGHT_REQUIRED_HEIGHT. This light pole is made of a skinny (rectangular) pole with a circle warning light on top. The function should take in the parameters of the x-position, y-position, and height of the pole.drawLightPole(poleX, poleY, poleHeight);JavaScriptOther Requirements:The bottom of all buildings should be located on the bottom edge of the canvas.The height of the pole is 1/6th the height of the building it is sitting on.The width of the pole is 5, as assigned to POLE_WIDTH, and should be centered horizontally on the top of the building.The warning light is a green circle of radius 10, sitting directly on top of the pole (the middle of the circle should be located at the center of the top of the pole.)IMPORTANT:In order to pass the test cases and the assignment, you must include a building with the following arguments:drawBuilding(100,350,225);Other than that, draw as many buildings as youd like! Below is an example of what your city could look like. Again, you only need the above building to pass the Test Cases, the rest is up to you!Challenge:Try adding windows and a door to your buildings! Get creative, use if/else statements to place features on some buildings and not others.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!