Name: ___________________________________ SET 3 ALL Due Monday Dec. 6th

Program 1 - "Let's Change the Slope"

• Plan on Graph Paper and submit with the code.
• See Unit 8 Lesson 3 as an example but use variable dimensions and vertex position.
• Follow the design recipe in HTDP section 2.5 showing the contract, purpose and header.
1. Write a function that draws a right triangle using the Cartesian Plane Code where:
• The hypotenuse is parallel to the x-axis
• The vertex where the sides intersect is on the y-axis.
• The vertex where the triangle begins on the Y-axis is an input variable.
• The length of each side is the same creating an isosceles right triangle.
• The movement distance from the vertex to an end-point of the hypotenuse is an input variable.
• Is this the same quantity for both the Y and X movement? ________
• What is the slope of the line drawing the left side of the triangle? ________
• What is the slope of the line drawing the right side of the triangle? ________

2. Write a function that draws a triangle using the Cartesian Plane Code where:

• The hypotenuse is parallel to the X-axis
• The vertex where the sides intersect is consumed as 2 numbers, X and Y
• The length of each side varies:
• The movement horizontally from the vertex to the right end-point of the hypotenuse is input with a number.
• The movement horizontally from the vertex to left end-point of the hypotenuse is input with a number.
• The height of the triangle from the vertex to the x-axis is input with a number.
• What is the slope of the line drawing the left side of the triangle? ________
• What is the slope of the line drawing the right side of the triangle? ________
1. Use your functions from program set 1 that finds the slope given two points to calculate the slope for each of the 6 sides of the triangles in the example from "Lets Change the Slope" WS.
• Use a text box to label your answers for each side. Label per diagram as AB, BC, AC, A'B', B'C'., A'C'.
• AB slope = ________ BC slope = _________ AC slope = _______
• A'B' slope = ________ B'C' slope = _________ A'C' slope = _______
1. Raise hand to get this checked: ________
• ____________________ lines in the same plane never intersect.
• Parallel lines have the same ______________.
• ____________________ lines are lines in the same plane that intersect to form right angles.
• Perpendicular lines are used to make sides of the _____________ triangles above.
• The slopes of perpendicular lines are the ___________ inverse of each other.
• If you were to TRANSLATE the first triangle from the Y-axis to the new position, what would be the directions?

(Hint: Review translations from last 6 weeks which will be on the semester test.)

1. Add this program and code to your web page for semester test portfolio (Set 4).

Bonus: Repeat the above but reverse the use of the X-axis and Y-axis.

Program 2 - Slope Functions

1. "Linear Equations" Special Cases U8L3 and U8L4

• Draw a line in DrScheme that has a 0 slope and passes through the point (-2, 1).
• What is the equation of this line? ____________________
• Draw a line in DrScheme that has a 0 slope that goes from Quadrant I to Quadrant II.
• What is the equation of this line? ____________________
• Draw 2 of the lines for the problems on the "Linear Equations" U8L3 worksheet and checked in QuizLab 6w3 U8L3 - Writing Equation of a Line.
• Draw a line that is parallel to one of the above lines.
• Draw a line that is perpendicular to one of the above lines. (Use negative inverse of slope.)
1. Write a function that calculates the Y-intercept given the slope and 1 point.
2. Hint: Look at the pattern of examples in finding the solutions to the linear equation worksheet to develop the function.

3. Write a function that calculates the slope of a line given two points.
4. Write a function that calculates the Y-intercept of a line given 2 points.
5. Hint: Reuse your slope function and Y-intercept functions

6. Use the data from the lines you drew in DrScheme for your test data in the above 3 functions.
7. Raise hand to get this checked: ____________

Bonus:

Draw the Five Lane Highway, Horizontal Hold, Tee Pee and Windmill from Lesson 4 in the 4-quadrant DrScheme Plane.

Program 3 - U8L4 - Saving Money

1. Write a function that calculates the amount of money you will have after t weeks. The function consumes the amount saved each week and the time in weeks that you save. Use the data in U8L4 "Birthday Gift" for your data.
2. Write a function that determines if you will have enough money saved to purchase something given the cost of the items, the weekly savings and the time in weeks. This function should use the above function. A negative answer means you do not have enough money and shows the amount short. A positive amount shows that you have enough money and how much extra. Use the data in "Birthday Gift" as your test data. Add data that reflects something you want to purchase. Document this. Show a positive and negative value.

Program 4 - Unit 8 - Cost with sales tax

1. Write a program for each of the 3 options for problem #28 on page 129 of your textbook.
2. Write a function to calculate sales tax at 8.25% of the total cost.
3. Write a function that adds the cost and the sales tax reusing each of the above functions.

Program 5 - Exercise 2.3.1.

Utopia's tax accountants always use programs that compute income taxes even though the tax rate is a solid, never changing 15%.

• Define the program tax, which determines the tax on the gross pay.
• Define netpay that determines the net pay of an employee from the number of hours worked. Assume an hourly rate of \$12.

Program 6 - Exercise 2.3.2.

The local supermarket needs a program that can compute the value of a bag of coins. Define the program sum-coins. It consumes four numbers: the number of pennies, nickels, dimes, and quarters in the bag; it produces the amount of money in the bag.

Program 7 - Exercise 2.3.3.

An old-style movie theater has a simple profit function. Each customer pays \$5 per ticket. Every performance costs the theater \$20, plus \$.50 per attendee. Develop the function total-profit. It consumes the number of attendees (of a show) and produces how much income the attendees produce.