Name: ___________________________________ SET 3 ALL Due Monday Dec. 6th
- 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.)
- Write a function that calculates the Y-intercept given the slope and 1 point.
Hint: Look at the pattern of examples in finding the solutions to the linear equation worksheet to develop the function.
- Write a function that calculates the slope of a line given two points.
- Write a function that calculates the Y-intercept of a line given 2 points.
Hint: Reuse your slope function and Y-intercept functions
- Use the data from the lines you drew in DrScheme for your test data in the above 3 functions.
- 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
- 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.
- 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
- Write a program for each of the 3 options for problem #28 on page 129 of your textbook.
- Write a function to calculate sales tax at 8.25% of the total cost.
- 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.