computer programming 12 mr. jean february 5 th, 2014

18
Computer Programming 12 Mr. Jean February 5 th , 2014

Upload: imogene-stevens

Post on 17-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Programming 12 Mr. Jean February 5 th, 2014

Computer Programming 12

Mr. Jean

February 5th, 2014

Page 2: Computer Programming 12 Mr. Jean February 5 th, 2014

The plan:

• Video clip of the day– http://www.youtube.com/watch?v=JjZNmhJ8X

u4

• Intro to Binary

• Intro to number systems

Page 3: Computer Programming 12 Mr. Jean February 5 th, 2014

Introduction to Binary:

Page 4: Computer Programming 12 Mr. Jean February 5 th, 2014

8 4 2 1

Base 2x2 x2 x2x2

1 or 0 1 or 0 1 or 0 1 or 0

Binary

Page 5: Computer Programming 12 Mr. Jean February 5 th, 2014

8 4 2 1

Base 2x2 x2 x2x2

1

2

4

10

Binary

Page 6: Computer Programming 12 Mr. Jean February 5 th, 2014

8 4 2 1

Base 2x2 x2 x2x2

1

2

4

10

Binary

0 0 0 1

0 0 1 0

0 1 0 0

1 0 1 0

Page 7: Computer Programming 12 Mr. Jean February 5 th, 2014

Base 21

2

4

10

Binary

0001

0010

0100

1010

Page 8: Computer Programming 12 Mr. Jean February 5 th, 2014

8 4 2 1

Base 2

x2 x2 x2x2

Binary

Bit

8 4 2 1

x2 x2 x2x2

Binary Digit =

Page 9: Computer Programming 12 Mr. Jean February 5 th, 2014

128 64 32 16 8 4 2 1

Base 2x2 x2 x2

Binary

Byte

x2x2x2x2

Page 10: Computer Programming 12 Mr. Jean February 5 th, 2014

Introduction to Binary:

• Marble Counting Machine:

• http://www.youtube.com/watch?v=GcDshWmhF4A

• http://www.youtube.com/watch?v=md0TlSjIags

Page 11: Computer Programming 12 Mr. Jean February 5 th, 2014

•KiloByte

•Megabyte

•Gigabyte

•TeraByte

1024 Bytes

1024 KiloBytes

1024 MegaBytes

512 256 128 64 32 16 8 4 2 1

1024 GigaBytes

1 1 1 1 1 1 1 1 1 1

1,048,576 Bytes

1,073,741,824 Bytes

1,099,511,627 ,776 Bytes

Page 12: Computer Programming 12 Mr. Jean February 5 th, 2014

Binary Video:

• https://www.youtube.com/watch?v=ry1hpm1GXVI

Page 13: Computer Programming 12 Mr. Jean February 5 th, 2014

Practice for Adding in Binary:Practice for Adding in Binary:

• Convert 20 to Binary• Convert 12 to Binary• Add the Two Binary Numbers together

• Convert 23 to Binary• Convert 31 to Binary• Add the Two Binary Numbers together• Find the Binary and decimal answer

1.

2.

Page 14: Computer Programming 12 Mr. Jean February 5 th, 2014

How to find 59?

• My first step is to find the largest power of 2 that is less than 59.

• 1, 2, 4, 8, 16, 32, 64.Ok, 64 is larger than 59 so we take one

step back and get 32. 32 is the largest power of 2 that is still smaller than 59.

• It can go in only once because 2 x 32 = 64 which is larger than 59. So, we write down a 1.

Page 15: Computer Programming 12 Mr. Jean February 5 th, 2014

• Now, we subtract 32 from 59: 59 – (1)(32) = 27. And we move to the next lower power of 2. In this case, that would be 16.How many full times can 16 go into 27? Once. So we write down another 1 and repeat the process. 1

• 1

Page 16: Computer Programming 12 Mr. Jean February 5 th, 2014

• 27 – (1)(16) = 11. The next lowest power of 2 is 8. How many full times can 8 go into 11? Once. So we write down another 1.

• 111

• 11• 11 – (1)(8) = 3. The next lowest power of 2 is 4.

How many full times can 4 go into 3? Zero. So, we write down a 0.

• 1110

Page 17: Computer Programming 12 Mr. Jean February 5 th, 2014

• 3 – (0)(4) = 3. The next lowest power of 2 is 2. – How many full times can 2 go into 3?– Once. So, we write down a 1.

• 11101• 3 – (1)(2) = 1. And finally, the next lowest

power of 2 is 1. How many full times can 1 go into 1? Once. So, we write down a 1.

• 111011

Page 18: Computer Programming 12 Mr. Jean February 5 th, 2014

To do: To do:

• Complete the first side of the binary sheet– Complete Questions 1 and 2

• Complete the “About Me” powerpoint

• Upcoming items:– Correcting Binary sheet– Adding and subtracting in binary