22
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.

Rating a Shoe

  • Upload
    thy

  • View
    27

  • Download
    0

Embed Size (px)

DESCRIPTION

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: - PowerPoint PPT Presentation

Citation preview

Page 1: Rating a Shoe

Rating a ShoeObjectives:1. Explain how sequence, selection, and

iteration are building blocks of algorithms2. Create equations with two or more

variables to represent relationships among quantities.

Page 2: Rating a Shoe

Warm-UpR = 3L + 3P + 2C + 2F

1. Solve for R given the following variable values:a) L = 7 P = 4 C = 8 F = 6b) L = 9 P = 8 C = 7 F = 4

2. Describe the relationship between variables L, P, C, & F.c) Do they all affect R equally?d) How does L affect R? e) How does L’s effect on R compare to P’s? f) How does L’s effect on R compare to C’s?

Page 3: Rating a Shoe

Factors for Choosing ShoesDiscuss with your neighbors:

What factors go into choosing a shoe?

Page 4: Rating a Shoe

Factors for Choosing ShoesLooks, Price, Comfort, Function

Page 5: Rating a Shoe

Which Shoe is Better?Shoe 1

Price: $180Comfort: pretty good, a little stiff, not that cushionyLooks: multiple colors, fancy style, famous brandFunction: medium weight, very durable, supportive

Shoe 2

Price: $45Comfort: okay, loose fit, not much cushionLooks: classic, retro, many color choices, minimal styling, famous brand

Function: medium weight, low durability, little support

Shoe 3

Price: $160Comfort: very good, soft, warm Looks: simple, one color, minimal stylingFunction: light weight, not durable, little support

Page 6: Rating a Shoe

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

Page 7: Rating a Shoe

Which Shoe is Better?

Shoe 1

Price: $180Comfort: pretty good, a little stiff, not that cushionyLooks: multiple colors, fancy style, famous brandFunction: medium weight, very durable, supportive

Shoe 2

Price: $45Comfort: okay, loose fit, not much cushionLooks: classic, retro, many color choices, minimal styling, famous brand

Function: medium weight, low durability, little support

Shoe 3

Price: $160Comfort: very good, soft, warm Looks: simple, one color, minimal stylingFunction: light weight, not durable, little support

How do we compute a rating (0 to 100) for

each shoe?

Page 8: Rating a Shoe

Which Shoe is Better?Shoe 1

Price: $180Comfort: pretty good, a little stiff, not that cushionyLooks: multiple colors, fancy style, famous brandFunction: medium weight, very durable, supportive

Shoe 2

Price: $45Comfort: okay, loose fit, not much cushionLooks: classic, retro, many color choices, minimal styling, famous brand

Function: medium weight, low durability, little support

Shoe 3

Price: $160Comfort: very good, soft, warm Looks: simple, one color, minimal stylingFunction: light weight, not durable, little support

We need numbers!

Page 9: Rating a Shoe

We need to Quantify it!Shoe 1

Price: $180Comfort: 6Looks: 8Function: 8

Shoe 2

Price: $45Comfort: okay, loose fit, not much cushionLooks: classic, retro, many color choices, very minimal styling, famous brand

Function: medium weight, low durability, not supportive

Shoe 3Price: $160Comfort: very good, soft, warm Looks: classic, retro, two colors, minimal styling, famous brandFunction: light weight, kinda durable

Rate the factors on a scale from 0-10.

0 = worst 10 = best

Page 10: Rating a Shoe

We need to Quantify it!Shoe 1

Price: $180Comfort: 6Looks: 8Function: 8

Shoe 2Price: $50Comfort: 5Looks: 7

Function: 6

Shoe 3

Price: $120Comfort: 8Looks: 7Function: 6

But what about the price? It isn’t in the same units as

the others.

Page 11: Rating a Shoe

We need to Quantify it!Shoe 1

Price: $180 (1)Comfort: 6Looks: 8Function: 8

Shoe 2Price: $50Comfort: 5Looks: 7

Function: 6

Shoe 3

Price: $120Comfort: 8Looks: 7Function: 6

We need to rate the price using the same scale (0 to 10) .

0 = Expensive, 10 = Inexpensive

Page 12: Rating a Shoe

SelectionIf price <= 20 Then price = 10ElseIf price <= 40 Then price = 9Etc…

Page 13: Rating a Shoe

Which Shoe is Better?Shoe 1

Price: $180Comfort: pretty good, a little stiff, not that cushiony

Looks: multiple colors, fancy style, famous brand

Function: medium weight, very durable, supportive

Shoe 2

Price: $45Comfort: okay, loose fit, not much cushionLooks: classic, retro, many color choices, minimal styling, famous brand

Function: medium weight, low durability, little support

Shoe 3Price: $160Comfort: very good, soft, warm Looks: simple, one color, minimal stylingFunction: light weight, not durable, little support

Do all the factors have the same importance?(We all know looks matters more than comfort, right?)

Page 14: Rating a Shoe

Priority• Put the four factors in order from most to

least important.Price, Comfort, Looks, Function

1. _________________ (most important)2. _________________3. _________________4. _________________ (least important)

Page 15: Rating a Shoe

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 33. Comfort x 24. Function x 2

Adds up to 10

____10

Page 16: Rating a Shoe

Equation to Rate a Shoe

Price: ____

Comfort: ____

Looks: ____

Function: ____

x ____ = ____

x ____ = ____

x ____ = ____

x ____ = ____

+

+

+

Rating: _________

0 to 10 Weight Total

Page 17: Rating a Shoe

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

Page 18: Rating a Shoe
Page 19: Rating a Shoe

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

VS.

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

Page 20: Rating a Shoe

SelectionIf repeat = "y" Then Goto StartEndIf Checks if the user

types in “y”

Page 21: Rating a Shoe

IterationIf repeat = "y" Then Goto StartEndIf Checks if the user

types in “y”Goes back to beginning and

repeats program

‘top of program codeStart: GraphicsWindow.Draw...

Page 22: Rating a Shoe

Exit Card1. 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.