1 / 22

Rating a Shoe

Rating a Shoe. Objectives: Explain how sequence, selection, and iteration are building blocks of algorithms Create equations with two or more variables to represent relationships among quantities. Warm-Up. R = 3 L + 3 P + 2 C + 2 F Solve for R given the following variable values:

thy
Télécharger la présentation

Rating a Shoe

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Rating a Shoe Objectives: Explain how sequence, selection, and iteration are building blocks of algorithms Create equations with two or more variables to represent relationships among quantities.

  2. Warm-Up R = 3L + 3P + 2C + 2F • Solve for Rgiven the following variable values: • L = 7 P = 4 C = 8 F = 6 • L = 9 P = 8 C = 7F = 4 2. Describe the relationship between variables L, P, C, & F. • Do they all affect R equally? • How does L affect R? • How does L’s effect on R compare to P’s? • How does L’s effect on R compare to C’s?

  3. Factors for Choosing Shoes Discuss with your neighbors: What factors go into choosing a shoe?

  4. Factors for Choosing Shoes Looks, Price, Comfort, Function

  5. Which Shoe is Better? Shoe 1 Shoe 2 Shoe 3 Price: $180 Comfort: pretty good, a little stiff, not that cushiony Looks: multiple colors, fancy style, famous brand Function: medium weight, very durable, supportive Price: $45 Comfort: okay, loose fit, not much cushion Looks: classic, retro, many color choices, minimal styling, famous brand Function: medium weight, low durability, little support Price: $160 Comfort: very good, soft, warm Looks: simple, one color, minimal styling Function: light weight, not durable, little support

  6. Computing a Problem • Identify Factors: Variables • Quantify: Numbers & Units • Express the Relationship: Equation • Algorithm: How my mind does it • Coded Algorithm: How computer does it

  7. Which Shoe is Better? Shoe 1 Shoe 2 Shoe 3 Price: $180 Comfort: pretty good, a little stiff, not that cushiony Looks: multiple colors, fancy style, famous brand Function: medium weight, very durable, supportive Price: $45 Comfort: okay, loose fit, not much cushion Looks: classic, retro, many color choices, minimal styling, famous brand Function: medium weight, low durability, little support Price: $160 Comfort: very good, soft, warm Looks: simple, one color, minimal styling Function: light weight, not durable, little support How do we compute a rating (0 to 100) for each shoe?

  8. Which Shoe is Better? Shoe 1 Shoe 2 Shoe 3 Price: $180 Comfort: pretty good, a little stiff, not that cushiony Looks: multiple colors, fancy style, famous brand Function: medium weight, very durable, supportive Price: $45 Comfort: okay, loose fit, not much cushion Looks: classic, retro, many color choices, minimal styling, famous brand Function: medium weight, low durability, little support Price: $160 Comfort: very good, soft, warm Looks: simple, one color, minimal styling Function: light weight, not durable, little support We need numbers!

  9. We need to Quantify it! Shoe 1 Shoe 2 Shoe 3 Price: $180 Comfort: 6 Looks:8 Function: 8 Price: $45 Comfort: okay, loose fit, not much cushion Looks: classic, retro, many color choices, very minimal styling, famous brand Function: medium weight, low durability, not supportive Price: $160 Comfort: very good, soft, warm Looks: classic, retro, two colors, minimal styling, famous brand Function: light weight, kinda durable Rate the factors on a scale from 0-10. 0 = worst 10 = best

  10. We need to Quantify it! Shoe 1 Shoe 2 Shoe 3 Price: $180 Comfort: 6 Looks: 8 Function: 8 Price: $50 Comfort: 5 Looks: 7 Function: 6 Price: $120 Comfort: 8 Looks: 7 Function: 6 But what about the price? It isn’t in the same units as the others.

  11. We need to Quantify it! Shoe 1 Shoe 2 Shoe 3 Price: $180 (1) Comfort: 6 Looks: 8 Function: 8 Price: $50 Comfort: 5 Looks: 7 Function: 6 Price: $120 Comfort: 8 Looks: 7 Function: 6 We need to rate the price using the same scale (0 to 10) . 0 = Expensive, 10 = Inexpensive

  12. Selection Ifprice <=20Then price =10 ElseIfprice <=40Then price =9 Etc…

  13. Which Shoe is Better? Shoe 1 Shoe 2 Shoe 3 Do all the factors have the same importance? (We all know looks matters more than comfort, right?) Price: $180 Comfort: pretty good, a little stiff, not that cushiony Looks: multiple colors, fancy style, famous brand Function: medium weight, very durable, supportive Price: $45 Comfort: okay, loose fit, not much cushion Looks: classic, retro, many color choices, minimal styling, famous brand Function: medium weight, low durability, little support Price: $160 Comfort: very good, soft, warm Looks: simple, one color, minimal styling Function: light weight, not durable, little support

  14. Priority • Put the four factors in order from most to least important. Price, Comfort, Looks, Function 1. _________________ (most important) 2. _________________ 3. _________________ 4. _________________ (least important)

  15. Weighting the Priorities • You have a total of 10 weights to use. Allocate the weights based on priority. 1. Looks x 3 2. Price x 3 3. Comfort x 2 4. Function x 2 Adds up to 10 ____ 10

  16. Equation to Rate a Shoe 0 to 10WeightTotal + + + Price: ____ Comfort: ____ Looks: ____ Function: ____ x ____ = ____ x ____ = ____ x ____ = ____ x ____ = ____ Rating: _________

  17. Sample Calculation 0 to 10WeightTotal + + + Price: 9 Comfort: 6 Looks: 7 Function: 5 x 2 = 18 x 2 = 12 x 4 = 28 x 2 = 10 Rating: 68

  18. Sequence TextWindow.WriteLine("Rate the price:") price=TextWindow.Read() VS. price=TextWindow.Read() TextWindow.WriteLine("Rate the price:")

  19. Selection Ifrepeat="y"Then GotoStart EndIf Checks if the user types in “y”

  20. Iteration Ifrepeat="y"Then GotoStart EndIf Checks if the user types in “y” Goes back to beginning and repeats program ‘top of program code Start: GraphicsWindow.Draw...

  21. Exit Card • Write down the equation you used to rate a shoe. • Write example sets of inputs for two shoes and calculate the rating. • Describe the relationship between the input variables. • How does each affect the rating? • Compare one variable’s effect to another.

More Related