Professional Documents
Culture Documents
Activity Guide Function Houses Unit 07 Lesson 01 Oly PDF
Activity Guide Function Houses Unit 07 Lesson 01 Oly PDF
● In the boxes below, show how you would call the function using different parameters (2 pts)
● Draw what your function should do in the space below for each of the two function calls above. If
doing this in Google Docs, double-click the grid and use the line tools. (2 pts)
1
/
Challenge #2: Create a cost calculator function for building the houses you created a function for earlier.
● Create a 2nd function using the same parameters as the first function you wrote (2 pts) ○
Think about the parameters. How would these impact the cost?
○ When the parameter is referenced in the function, make it bold to draw attention. ○
Add a return at the end of your function that returns the total cost..
name Parameter 1 name Parameter 2 name
1ft = 5$
If sideLength=10ft cost is 10$
Function: drawHouse cost = 42$
Function: drawSmallerHouse = 27$
}
● In the boxes below, show how you would call the function using different parameters. (2
pts) ○ Show the expected return value for each function call in the right column.
Function calls Return Value
// Example usage:
// A 2000 square feet house with 3 bedrooms, 2 bathrooms, using premium materials
const costOfMyHouse = calculateHouseBuildingCost(2000, 3, 2, 'premium');
console.log('The cost to build your house is: $' + costOfMyHouse);
// This will output something like:
// "The cost to build your house is: $330000"
Warm Up:
Making your code easier to work with or read enhances maintainability, facilitates collaboration, and accelerates
debugging and future development.
Activity:
A four-layer chocolate cake would consist of four individual cake layers stacked on top of each other, each separated
by a layer of frosting or filling. The outside of the cake could be covered with more chocolate frosting, smoothed or
textured as per your preference. For decoration, you might see chocolate shavings, chocolate pieces, or other
adornments on top. Would you like to see a visual representation of such a cake?