Download Java Methods 2nd AP edition

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Low Pin Count wikipedia , lookup

I²C wikipedia , lookup

Direct memory access wikipedia , lookup

Bus (computing) wikipedia , lookup

Transcript
Java Methods
Object-Oriented Programming
and Data Structures
2nd AP edition  with GridWorld
Maria Litvin ● Gary Litvin
ch 001
An Introduction to Hardware,
Software, and the Internet
Copyright © 2011 by Maria Litvin, Gary Litvin, and Skylight Publishing. All rights reserved.
Daily Tweet
• Write a Tweet about why you choose to take
AP Computer Science.
• Include your tweet handle (first name.last
name) and a hash tag. (#PCROCK)
(#CSRULES)
1-2
Objectives:
• Get an overview of the main hardware
components and terms: CPU, memory,
peripheral devices
• Learn about software: operating system and
application software
• Get an idea of how information is stored in
computer memory
• Learn basic facts about the Internet
1-3
The text for this chapter
is online at:
www.skylit.com/javamethods
1-4
Hardware
• The CPU (Central Processing Unit) is made
of millions of semiconductor devices, called
transistors, etched into a silicon chip.
• Transistors are combined to form logical
devices called gates.
• All digital electronics is basically made up of
gates.

https://www.youtube.com/watch?v=Xi18hI1LqAA
1-5
Gates
AND gate
A
OR gate
NOT gate
A
A OR B
A AND B
B
A
NOT A
B
A B
T
T
F
F
T
F
T
F
A AND B
T
F
F
F
A B
T
T
F
F
T
F
T
F
A OR B
A
T
T
T
F
T
F
NOT A
F
T
1-6
Example: XOR Circuit
A
A AND (NOT B)
B
OR
A XOR B
(NOT A) AND B
A B
T
T
F
F
T
F
T
F
A XOR B
F
T
T
F
1-7
Gates
• Logic Labhttp://www.neuroproductions.be/logic-lab/
• Worksheet-In Class
• Homework Worksheet
• Snap Circuits Complete 5 of them
1-8
Gates
or
Nand
and
XNor
xor
not
Nor
1 byte = 8 bits
RAM
0 0 1 0 1 1 0 1
bit 7
bit 0
• 1 KB (kilobyte) = 1024 bytes
210
• 1 MB (megabyte) = 1024 · 1024 bytes
220  106, a million
• 1 GB (gigabyte) = 1024 · 1024 · 1024 bytes
230  109, a billion
• 1 TB (terabyte) = 1024 gigabyes
• 1 PB (petabyte) = 1024 terabyes
1-10
RAM, CPU, Bus
Memory
(RAM)
CPU
Registers
Address
bus
Data
bus
Memory
(ROM)
1-11
Registers



Built in memory cells that old operands, memory
address and intermediate results. Some are
accessible by the programmer.
Instruction sets includes instructions for loading
CPU registers from memory and storing their
values in memory for logical and arithmetic
operations, and for altering the sequence of
operations.
Internal clocks
• Clock Cycles
– Frequency of the clock pulses measures the duration
– Speed depends on internal clock
1-12
Bus
• Digital electronics

Address Bus
• Specifying Memory Addresses

Data Bus
• Reading and writing memory values
• The speed of the computer also depends on
the speed of the bus transfers and the width
of the bus.
1-13
Motherboard
Extension slots
CPU
RAM
(SIMMs)
ROM
1-14
Hardware Terms
• CPU — Central Processing Unit
• RAM — Random-Access Memory


“random-access” means the CPU can read
directly from and write to any memory location
holds both data and CPU instructions
• ROM — Read-Only Memory

holds initialization and hardware diagnostic
programs
• Peripheral devices (secondary storage,
input/output)
1-15
CPU
• In personal computers, the
CPU is a microprocessor,
contained on one chip.
• The CPU speed is measured
Heinrich Rudolf
Hertz
in GHz (gigahertz, billions of
clock cycles per second) or, in
older computers, in MHz
(megahertz, millions of cycles).
• A CPU instruction takes one or
several clock cycles.
1-16
Secondary Storage
Hard disk:
100 - 1000 GB
CD-ROM:
700 MB
Flash drive:
1 - 8 GB
A file is a
software concept
1-17
I/O Devices
•
•
•
•
•
Monitor and video adapter
Keyboard, mouse or touch pad
Sound card, speakers, microphone
Internet adapter, wi-fi (wireless) adapter
D/A (digital-to-analog) and A/D (analog-todigital) converters
• Scanners, digital cameras, printers
1-18
Checking for Understanding
•
•
•
•
•
Log on to your computer
Go to socrative.com
Student Log in
Room #191260
Complete the Quiz
1-19
Software Layers
Applications
Operating system
Device drivers
BIOS, firmware
1-20
Software Terms
• Operating system

a program that maintains the file system,
dispatches applications, and provides other
system-level services
• Console application

a program with simple text user interface
• GUI — Graphical User Interface

graphics, menus, buttons, icons, etc.
• OOP — Object-Oriented Programming
1-21
Software Engineers are Able To:
• Absorb and use emerging technical
information
• Create sound software system architectures
• Understand and devise effective algorithms
• Be proficient with the syntax and style of
programming languages
• Diagnose and correct programming errors
Continued...
1-22
The Internet Layers
Applications: telnet, www,
e-mail, IM, FTP, Voice
Transport: delivering data
reliably and securely (TCP)
Internetworking: routing and
forwarding data (IP)
Network technology
(switches, adapters, routers)
1-23
Software Engineers are Able To:
• Use software development tools and
documentation
• Find and utilize reusable software
components
• Design and implement friendly user interfaces
• Uphold the highest standards of professional
ethics
1-24
Numbers In Memory
• Integers are represented in binary (base 2)
0
1
2
3
...
255
00000000
00000001
00000010
00000011
...
11111111
• Java uses 4 bytes for an integer (int data
type)
1-25
Numbers In Memory (cont’d)
• For signed numbers, the most significant
bit indicates the sign:
17
00000000 00000000 00000000 00010001
Sign bit
16 + 1
• Negative numbers are represented in
two’s-complement form
-17
11111111 11111111 11111111 11101111
Sign bit
17 + (-17) = 232 = 0
1-26
Numbers in Memory (cont’d)
• Real numbers are represented as floatingpoint numbers (similar to scientific notation)
with a sign, binary mantissa (fractional part),
and binary exponent.
• Java uses 8 bytes (64 bits) for a “double”
(that is, double-precision) floating-point
number.
double’s range is from -1.8  10308 to 1.8  10308
(but precision is only 14 significant digits)
1-27
Characters
• Unicode associates characters with numbers
(2 bytes represent a character).
• ASCII (American Standard Code for
Information Interchange) is a subset
comprising the first 128 codes of Unicode:


<space>
‘0’ - ‘9’
32
48 - 57
 ‘A’ - ‘Z’
 ‘a’ - ‘z’
65 - 90
97 - 122
• The first 32 codes are control codes
(Carriage Return, Newline, Tab, etc.).
1-28
Binary –Hexadecimal-ASCII
• https://www.youtube.com/watch?v=tfKe8PPI2zs
• Worksheet
 https://www.youtube.com/watch?v=Zy-yDEgTJdg
• Worksheet
1-29
The Internet
• A network of interconnected computers that
share common communication protocols,
TCP/IP
• TCP: Transmission Control Protocol
• IP: Internet Protocol
1-30
The Internet Terms
• Browser

provides convenient way to download and display
information from the Internet
• Search engine

indexes and helps find the Internet documents that
contain specified keywords and phrases
• Portal

a large popular web site that has a collection of
links arranged by category
1-31
The Internet Terms (cont’d)
• Host

a computer connected to a network
• Server

a computer on a network that provides a particular
service (e.g., e-mail server)
• URL

Uniform Resource Locator, an address of a
document or a resource on the Internet
1-32
Checking for Understanding
•
•
•
•
•
Log on to your computer
Go to socrative.com
Student Log in
Room #191260
Complete the Quiz
Assignment
• Book exercises: #5, 8, 10, 11, 12, 13, 15, 19,
20
1-34
Chapter 1 Test
1-35