Chapter 1 Introduction
Java Software Solutions
Foundations of Program Design
Seventh Edition Focus of the Cour
•Object-Oriented Software Development –problem solving
–program design, implementation, and testing –object-oriented concepts
•class
•objects
•encapsulation
•inheritance
•polymorphism
–graphical ur interfaces
–the Java programming language
Introduction
•We start with the fundamentals of computer processing
•Chapter 1 focus on:
–components of a computer
–how computers store and manipulate information –computer networks
–the Internet and the World Wide Web
–programming and programming languages
–an introduction to Java
–an overview of object-oriented concepts Outline
Computer Processing
Hardware Components
Networks
The Java Programming Language
Program Development
Object-Oriented Programming
Hardware and Software
•Hardware
–the physical, tangible parts of a computer
–keyboard, monitor, disks, wires, chips, etc. •Software
–programs and data
–a program is a ries of instructions
• A computer requires both hardware and software •Each is esntially uless without the other CPU and Main Memory
Central
Processing
Unit
淡菜怎么做好吃Main
Memory
Chip that executes
program commands
Primary storage area
for programs and data
that are in active u
Synonymous with RAM
Input / Output Devices
Central Processing
Unit
Main Memory Monitor screen Keyboard Mou
Touch screen
I/O devices facilitate ur interaction Secondary Memory Devices
Central
Processing
Unit
Main
Memory
Information is moved
between main and
condary memory
as needed
Hard Disk
USB Flash Drive Secondary memory
devices provide
long-term storage
Software Categories
•Operating System
–controls all machine activities
–provides the ur interface to the computer
–manages resources such as the CPU and memory
–Windows, Mac OS, Unix, Linux,
•Application program
–generic term for any other kind of software
–word processors, missile control systems, games •Most operating systems and application programs have a graphical ur interface (GUI) Analog vs. Digital
•There are two basic ways to store and manage data:
•Analog
–continuous, in direct proportion to the data reprented
–music on a record album - a needle rides on ridges in the grooves that are directly proportional to the voltages nt to the speaker •Digital我是九零后
–the information is broken down into pieces, and each piece is reprented parately
–sampling – record discrete values of the analog reprentation
–music on a compact disc - the disc stores numbers reprenting specific voltage levels sampled at specific times
Analog Information Sampling
Digital Information
•Computers store all information digitally:生宝宝的祝福语
–numbers –text
–graphics and images –audio –video
–
program instructions
•In some way, all information is digitized - broken down into pieces and reprented as numbers
Reprenting Text Digitally
•For example, every character is stored as a
number, including spaces, digits, and punctuation •Corresponding upper and lower ca letters are parate characters
H i , H e a t h e r .
72 105 44 32 72 101 97 116 104 101 114 46
Binary Numbers
•Once information has been digitized, it is reprented and stored in memory using the binary number system • A single binary digit (0 or 1) is called a bit
•Devices that store and move information are cheaper and more reliable if they have to reprent onl
y two states • A single bit can reprent two possible states, like a light bulb that is either on (1) or off (0) •Permutations of bits are ud to store values
Bit Permutations
空前的意思
1 bit 0 1
2 bits 00 01 10 11
3 bits 000 001 010 011 100 101 110 111
4 bits 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
Each additional bit doubles the number of possible permutations
Bit Permutations
•Each permutation can reprent a particular item •There are 2N
permutations of N bits
•Therefore, N bits are needed to reprent 2N unique items
21 = 2 items 22 = 4 items 23 = 8 items 24 = 16 items 25 = 32 items
1 bit ?
2 bits ?
3 bits ?
4 bits ?
5 bits ?
How many items can be reprented by
Quick Check
How many bits would you need to reprent each of the 50 United States using a unique permutation of bits?
Quick Check
小青豆
How many bits would you need to reprent each of the 50 United States using a unique permutation of bits? Five bits wouldn't be
enough, becau 25 is 32. Six bits would give us 64 permutations, and some wouldn't be ud.
000000 Alabama 000001 Alaska 000010 Arizona 000011 Arkansas 000100 California 000101 Colorado etc.
Outline
Computer Processing Hardware Components Networks
The Java Programming Language Program Development Object-Oriented Programming
A Computer Specification
•Consider the following specification for a personal computer:
–3.07 GHz Intel Core i7 processor –4 GB RAM
–750 GB Hard Disk
–
16x Blu-ray / HD DVD-ROM & 16x DVD+R DVD Burner
–17” Flat Screen Video Display with 1280 x 1024 resolution –Network Card
Computer Architecture
Memory
Main memory is divided into many memory locations (or cells )
9278 9279 9280 9281 9282 9283 9284 9285 9286
Each memory cell has a numeric address , which uniquely identifies it
清代书法家Storing Information
9278
9279 9280 9281 9282 9283 9284 9285 9286
Large values are stored in concutive memory locations
10011010 Each memory cell stores a t number of bits (usually 8 bits, or one byte )
Storage Capacity
•Every memory device has a storage capacity, indicating the number of bytes it can hold •Capacities are expresd in various units:
煮水
Unit Symbol Number of Bytes
kilobyte KB 210 = 1024
megabyte MB 220 (over one million)
gigabyte GB 230 (over one billion)
terabyte TB 240 (over one trillion)
petabyte PB 250 (a whole bunch) Memory
•Main memory is volatile - stored information is lost if the electric power is removed
微信男生头像•Secondary memory devices are nonvolatile
•Main memory and disks are direct access devices - information can be reached directly
•The terms direct access and random access often are ud interchangeably
• A magnetic tape is a quential access device since its data is arranged in a linear order - you must get by the intervening data in order to access other information
Hard Disk Drive RAM vs. ROM
•RAM - Random Access Memory (direct access)
•ROM - Read-Only Memory
•The terms RAM and main memory are basically
interchangeable
•ROM could be a t of memory chips, or a parate
device, such as a CD ROM
•Both RAM and ROM are random (direct) access devices!
•RAM probably should be called Read-Write Memory
Compact Discs
• A CD-ROM is portable read-only memory
• A microscopic pit on a CD reprents a binary 1 and a smooth area reprents a binary 0
• A low-intensity lar reflects strongly from a smooth area and weakly from a pit
• A CD-Recordable (CD-R) drive can be ud to write information to a CD once
• A CD-Rewritable (CD-RW) can be erad and reud •The speed of a CD drive indicates how fast (max) it can read and write information to a CD DVDs
• A DVD is the same physical size as a CD, but can store much more information
•The format of a DVD stores more bits per square inch
• A CD can store 650 MB, while a standard DVD can store 4.7 GB
–A double sided DVD can store 9.4 GB
–Other advanced techniques can bring the capacity up to
17.0 GB
•Like CDs, there are DVD-R and DVD-RW discs