computer programming {week 01}
DESCRIPTION
Hudson Valley Community College CISS-110 – Programming & Logic I David Goldschmidt, Ph.D. Computer programming {week 01}. Computer subsystems. Hardware consists of five key subsystems:. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Computer programming {week 01}](https://reader033.vdocuments.us/reader033/viewer/2022051019/56814f66550346895dbd1bbf/html5/thumbnails/1.jpg)
Computer programming{week 01}
Hudson Valley Community CollegeCISS-110 – Programming & Logic IDavid Goldschmidt, Ph.D.
![Page 2: Computer programming {week 01}](https://reader033.vdocuments.us/reader033/viewer/2022051019/56814f66550346895dbd1bbf/html5/thumbnails/2.jpg)
Computer subsystems
Hardware consists of five key subsystems:
from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
![Page 3: Computer programming {week 01}](https://reader033.vdocuments.us/reader033/viewer/2022051019/56814f66550346895dbd1bbf/html5/thumbnails/3.jpg)
Fetch/Execute cycle
Each instruction goes through this cycle:
from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
![Page 4: Computer programming {week 01}](https://reader033.vdocuments.us/reader033/viewer/2022051019/56814f66550346895dbd1bbf/html5/thumbnails/4.jpg)
Example ADD instruction (i)
from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
![Page 5: Computer programming {week 01}](https://reader033.vdocuments.us/reader033/viewer/2022051019/56814f66550346895dbd1bbf/html5/thumbnails/5.jpg)
Example ADD instruction (ii)
from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
![Page 6: Computer programming {week 01}](https://reader033.vdocuments.us/reader033/viewer/2022051019/56814f66550346895dbd1bbf/html5/thumbnails/6.jpg)
Example ADD instruction (iii)
from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
![Page 7: Computer programming {week 01}](https://reader033.vdocuments.us/reader033/viewer/2022051019/56814f66550346895dbd1bbf/html5/thumbnails/7.jpg)
Example ADD instruction (iv)
from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
![Page 8: Computer programming {week 01}](https://reader033.vdocuments.us/reader033/viewer/2022051019/56814f66550346895dbd1bbf/html5/thumbnails/8.jpg)
Example ADD instruction (v)
from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
![Page 9: Computer programming {week 01}](https://reader033.vdocuments.us/reader033/viewer/2022051019/56814f66550346895dbd1bbf/html5/thumbnails/9.jpg)
Example ADD instruction (vi)
from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
![Page 10: Computer programming {week 01}](https://reader033.vdocuments.us/reader033/viewer/2022051019/56814f66550346895dbd1bbf/html5/thumbnails/10.jpg)
Even faster!
from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
![Page 11: Computer programming {week 01}](https://reader033.vdocuments.us/reader033/viewer/2022051019/56814f66550346895dbd1bbf/html5/thumbnails/11.jpg)
Counting
We use ten symbols to count Digits: 0 1 2 3 4 5 6 7 8 9
Computers use two symbols to count Digits: 0 1 (why?)
What is the exact mechanism for counting? How do we count from 1 to 20?
![Page 12: Computer programming {week 01}](https://reader033.vdocuments.us/reader033/viewer/2022051019/56814f66550346895dbd1bbf/html5/thumbnails/12.jpg)
Convert binary to decimal
The powers of 2 give us the decimal weights Convert 10011001 from binary to decimal:
10011001 in decimal is 128 + 16 + 8 + 1 = 153
powers of 2 27 26 25 24 23 22 21 20
decimal weights
128
64 32 16 8 4 2 1
binary digits 1 0 0 1 1 0 0 1
![Page 13: Computer programming {week 01}](https://reader033.vdocuments.us/reader033/viewer/2022051019/56814f66550346895dbd1bbf/html5/thumbnails/13.jpg)
Hexadecimal
Hexadecimal is base 16 It uses 16 digits: 0 1 2 3 4 5 6 7 8 9 A B C D E F
Why use hex? Binary numbers are too long
What’s 2BAD in decimal?
decimal
binary
hexadecimal
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F
![Page 14: Computer programming {week 01}](https://reader033.vdocuments.us/reader033/viewer/2022051019/56814f66550346895dbd1bbf/html5/thumbnails/14.jpg)
ASCII
Representprintableand specialcharacters
What aboutUnicode?
from Fluency with Information Technology, 4th edition by Lawrence Snyder, Addison-Wesley, 2010, ISBN 0-13-609182-2
![Page 15: Computer programming {week 01}](https://reader033.vdocuments.us/reader033/viewer/2022051019/56814f66550346895dbd1bbf/html5/thumbnails/15.jpg)
Java compilation and execution
public static void main( String[] args ){ float x;
System.out. println( "
...
Java source code
7A 56 789F FE F265 58 9976 6D 4E
intermediate code(byte code)
translation program
(compiler)
virtual machine
(JVM)
A6 65 5498 8F ABAE 33 388F DA 44
intermediate code ofprecompiled libraries
(java.util.Scanner byte code)
program execution
![Page 16: Computer programming {week 01}](https://reader033.vdocuments.us/reader033/viewer/2022051019/56814f66550346895dbd1bbf/html5/thumbnails/16.jpg)
What next?
Read and study Chapter 1 Get Textpad up and running
Do Project #1: Given a 3-digit number: Generate output that shows each digit:
int num = 582;
The number is 582The hundreds column is 5The tens column is 8The ones column is 2