+ All Categories
Home > Documents > Lecture Wed Week 7

Lecture Wed Week 7

Date post: 01-Jan-2016
Category:
Upload: brendan-wagner
View: 24 times
Download: 1 times
Share this document with a friend
Description:
Lecture Wed Week 7. Midterm grades on gradesource Graded out of 26 (free point) Question 1 confusing – everyone gets full points Solutions posted soon Great job!. Could you help me out Please be completely honest…. How many hours did you study for the midterm?. None 1 hour 2 hours - PowerPoint PPT Presentation
Popular Tags:
33
Lecture Wed Week 7 Midterm grades on gradesource Graded out of 26 (free point) Question 1 confusing – everyone gets full points Solutions posted soon Great job! 0 0.2 0.4 0.6 0.8 1 1.2
Transcript
Page 1: Lecture Wed Week 7

Lecture Wed Week 7

• Midterm grades on gradesource– Graded out of 26 (free point)– Question 1 confusing – everyone gets full points– Solutions posted soon

• Great job!

1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 860

0.2

0.4

0.6

0.8

1

1.2

Page 2: Lecture Wed Week 7

Could you help me out Please be completely honest…

Page 3: Lecture Wed Week 7

How many hours did you study for the midterm?

A. NoneB. 1 hourC. 2 hoursD. 3 hoursE. More than 3 hours

Page 4: Lecture Wed Week 7

How did you spend your study time?

A. Working with the sample midterm/clicker questions

B. Reading the bookC. Both fairly evenly

Page 5: Lecture Wed Week 7

Were you surprised by the content of the exam?

A. Not at allB. A little bitC. Quite a bitD. I was completely surprised

Page 6: Lecture Wed Week 7

Tech and Society #2:Ifs and Events on the Web…

(due Tuesday Week 8)

• Let’s look on moodle• The Web:– New Opportunities for Social Particpation

• Explore account creation and a web site– Answer “questions” (like lab) on surveymonkey

about the experience• Forum Post– Reflection on power of “pervasive” computing

Page 7: Lecture Wed Week 7

Suppose there is a list of Customers (people waiting in line). You want to serve each

customer one at a time, so each one should walk into the store one at a time.

A. Use a DoTogether tileB. Use a DoInOrder tileC. Use a ForAllTogether tileD. Use a ForAllInOrder tile

Page 8: Lecture Wed Week 7

Which of the following types can be used in a list?

A. RocketteB. Rockette’s ThighsC. Rockette’s HipsD. All of the Above

Page 9: Lecture Wed Week 7

If I declare a list thusly, and use a ForAllInOrder tile, what order do the rockettes kick?

Order

A rocketterockette2rockette3

B rocketterockette3rockette2

C You can’t be sure

D None of the above

Page 10: Lecture Wed Week 7

Finish Section 7.2 While (Indeterminate) Loops

• Did you watch the video?– Please do!

Page 11: Lecture Wed Week 7

Chapter 9-1 Lists

• Our last Alice chapter • After Chapter 9, we’ll move into the white and

red Excel book– A certain amount of background excel knowledge

is expected.– We have an online quiz to help you figure out if

you don’t have that background• And an online tutorial to help you get it• You will need to do this on your own

Page 12: Lecture Wed Week 7

Old Budweiser Commercial

• Three frogs, together they say Budwesier– Frog 1 (on left) “Bud”– Frog 2 (in middle) “weis”– Frog 3 (on right) “er”

• That’s hard – let’s start with– Three frogs talk in order left to right– Like this:

Page 13: Lecture Wed Week 7

What does this code do?

Page 14: Lecture Wed Week 7

What does this code do?A. The frogs talk in order

left to rightB. The frogs talk in

backwards order (right to left)

C. Each frog talks, but the order depends

Page 15: Lecture Wed Week 7

It ALWAYS goes in the order you make your list in

Page 16: Lecture Wed Week 7

Let’s assume I remake my list like

this (L to R):

Page 17: Lecture Wed Week 7

What if I want the frogs to say Hello (left to right) 5 times?

A. Make a counted loop run five times INSIDE (as the inner loop) the ForAllInOrder loop

B. Make a counted loop run five times with the ForAllInOrder loop INSIDE (as the inner loop)

Page 18: Lecture Wed Week 7

Predict: What would this code do?

• ???

Page 19: Lecture Wed Week 7

By the way… you can make a list out of different kinds of objects

• Do the wave with different “People” objects• Make different types of flowers grow

And out of other things…

Page 20: Lecture Wed Week 7

Problem: Each frog should say something different…Bud

Wei

Ser

Page 21: Lecture Wed Week 7

What programming construct would you use?

A. An if statement inside the For all in orderB. A counted loop inside the For all in orderC. An if statement before the For all in orderD. A counted loop outside the For all in orderE. I don’ t know…

Page 22: Lecture Wed Week 7

There are (at least) two possible solutions… What is the BEST explanation of why is one

better than the other? A. Option 1 is better because it is shorterB. Option 1 is better because it does the least

number of “checks” (or boolean condition evaluations)

C. Option 2 is better because it makes clear exactly what the “checks” (or boolean condition evaluations) are

D. Option 2 is better because it has a regular structure with empty “else” portions

Page 23: Lecture Wed Week 7

A) ShorterB) Least

Boolean Checks

C) Clear BooleanChecksD) RegularStructure withEmpty “else”es

Page 24: Lecture Wed Week 7

Remember this…

• “Good” programs aren’t (always) the ones that– Make it easiest on the programmer– Are easiest for humans to read– Require least amount of effort from programmer

• Instead they are (usually) the ones that– Require least computing work (by computer)– Are easiest to adapt to new situations• Methods and parameters come in here

Page 25: Lecture Wed Week 7

There’s an EVEN BETTER way to write this program!

• Think about this…– What if we had…• A list of froggies

– Some number of frogs that want to talk

• A list of words– Exactly the same “number” of Strings to be “said” by each of

those frogs…

– How can we make a program that will make each frog say a specific word• In ONLY 2 LINES OF CODE?!?!?

Page 26: Lecture Wed Week 7

Let’s make the beetles do a more complicated dance…

• Like this:

Page 27: Lecture Wed Week 7

Which structure would you want?

A. One ForAllInOrder loopB. One ForAllInOrder loop with an if statement

insideC. One if statement with a ForAllTogether insideD. None of the above

Page 28: Lecture Wed Week 7

Does this code correctly implement our intended behavior?

A. YesB. NoC. I don’t know

And WHY!

Page 29: Lecture Wed Week 7

What is new about this code?

• Nested “for all” loops• A loop that “iterates” over all items in a list– Inside that is another loop that goes over all the

items in a list– In this case, happen to be the same list

• Wow, you can do complicated things now…

Page 30: Lecture Wed Week 7
Page 31: Lecture Wed Week 7

There are 4 beetles, how many times is this instruction executed?

A. 4B. 12C. 16D. 48E. I don’t know

Page 32: Lecture Wed Week 7

Parameters to methods:We can do better now!

Page 33: Lecture Wed Week 7

How would we do our “new” solo (with backup)


Recommended