# Rating a Shoe Objectives: 1.Explain how sequence, selection, and iteration are building blocks of algorithms 2.Create equations with two or more variables.

## Presentation on theme: "Rating a Shoe Objectives: 1.Explain how sequence, selection, and iteration are building blocks of algorithms 2.Create equations with two or more variables."— Presentation transcript:

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

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

Warm-Up R = 3 L + 3 P + 2 C + 2 F Solve for R given the following variable values: 1. L = 7P = 8C = 8F = 6 2. L = 9P = 4C = 7F = 4 3. L = 6P = 6C = 9F = 8

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

Factors for Choosing Shoes Looks, Price, Comfort, Function

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

Factors for Choosing Shoes Looks, Price, Comfort, Function

Which Shoe is Better? Shoe 1 Price: \$180 Comfort: pretty good, a little stiff, not that cushiony Looks: multiple colors, fancy style, famous brand Function: medium weight, very durable, supportive Shoe 2 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 Shoe 3 Price: \$160 Comfort: very good, soft, warm Looks: simple, one color, minimal styling Function: light weight, not durable, little support

Computing a Problem 1.Identify Factors: Variables 2.Quantify: Numbers & Units 3.Express the Relationship: Equation 4.Algorithm: How my mind does it 5.Coded Algorithm: How computer does it

Which Shoe is Better? Shoe 1 Price: \$180 Comfort: pretty good, a little stiff, not that cushiony Looks: multiple colors, fancy style, famous brand Function: medium weight, very durable, supportive Shoe 2 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 Shoe 3 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?

Which Shoe is Better? Shoe 1 Price: \$180 Comfort: pretty good, a little stiff, not that cushiony Looks: multiple colors, fancy style, famous brand Function: medium weight, very durable, supportive Shoe 2 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 Shoe 3 Price: \$160 Comfort: very good, soft, warm Looks: simple, one color, minimal styling Function: light weight, not durable, little support We need numbers!

We need to Quantify it! Shoe 1 Price: \$180 Comfort: 6 Looks: 8 Function: 8 Shoe 2 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 Shoe 3 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

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

We need to Quantify it! Shoe 1 Price: \$180 (1) Comfort: 6 Looks: 8 Function: 8 Shoe 2 Price : \$50 Comfort: 5 Looks: 7 Function : 6 Shoe 3 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

Selection If price <= 20 Then price = 10 ElseIf price <= 40 Then price = 9 Etc…

Which Shoe is Better? Shoe 1 Price: \$180 Comfort: pretty good, a little stiff, not that cushiony Looks: multiple colors, fancy style, famous brand Function: medium weight, very durable, supportive Shoe 2 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 Shoe 3 Price: \$160 Comfort: very good, soft, warm Looks: simple, one color, minimal styling Function: light weight, not durable, little support Do all the factors have the same importance? (We all know looks matters more than comfort, right?)

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

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

Equation to Rate a Shoe Price: ____ Comfort: ____ Looks: ____ Function: ____ x ____ = ____ ++++++ Rating: _________ 0 to 10 Weight Total

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

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

Selection If repeat = "y" Then Goto Start EndIf Checks if the user types in “y”

Selection If repeat = "y" Then Goto StartElse Program.End() Program.End() EndIf Checks if the user types in “y”

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

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

Download ppt "Rating a Shoe Objectives: 1.Explain how sequence, selection, and iteration are building blocks of algorithms 2.Create equations with two or more variables."

Similar presentations