Introduction to Computers

advertisement
MIS 131
Introduction to Algorithms
and Programming
2015/2016 Fall
- Chapter 1 1
Computers and C++
Programming
Outline
1.1
1.2
1.3
1.6
1.7
1.8
1.13
1.14
Introduction
What Is a Computer?
Computer Organization
Machine Languages, Assembly Languages and High-level
Languages
The History of C
The C Standard Library
Structured Programming
The Basics of a typical C Program Development Environment
2
Outline





Outline
Introduction
What Is a Computer?
Computer Organization
Machine Languages, Assembly Languages
and High-level
Languages
3
What is a Computer?



Computer
 Device capable of performing computations
and making logical decisions
 Computers process data under the control of
sets of instructions called computer programs
Hardware
 Various devices comprising a computer
 Keyboard, screen, mouse, disks, memory, CDROM, and processing units
Software
 Programs that run on a computer
4
Software

System programs
 Operating systems


Utility programs - Compilers and interpreters



Microsoft 7,10, Unix, Unix, Android
C,C++,Java compilers
QBasic interpreter
Application Programs
 LOGO accounting
 SPSS statistics
5
Six logical units in every computer:






Input unit
 Obtains information from input devices (keyboard, mouse)
Output unit
 Outputs information (to screen, to printer, to control other
devices)
Memory unit
 Rapid access, low capacity, stores input information
Arithmetic and logic unit (ALU)
 Performs arithmetic calculations and logic decisions
Central processing unit (CPU)
 Supervises and coordinates the other sections of the computer
Secondary storage unit
 Cheap, long-term, high-capacity storage
 Stores inactive programs
6
Three types of programming languages



Machine languages
Assembly languages
High-level languages
7
Machine languages
•
Strings of numbers giving machine specific
instructions
• Natural language of the computer
•
•
•
0-1 corresponding to high or low voltage
Instructions and data are encoded into binary
numbers
Example:
•
•
•
100111001011
110010100110
001011100101
8
Assembly languages

English-like abbreviations representing
elementary computer operations (translated via
assemblers)
 Example:
LOAD
ADD
STORE
BASEPA
OVERPAY
GROSSPAY
9
High-level languages



Codes similar to everyday English
Use mathematical notations (translated via
compilers)
Example:
grossPay = basePay + overTimePay
10






grossPay = basePay + overTimePay
 one line of a programm
Variables
 grossPay
 basePay
 overTimePay
Onces compiled turn into machine code
after loading each has an adress in main
memory of the computer
executing the sum instruction
basePay and overTimePay has values they
are summed and assigned to grossPay
11
Meaning of computer programming

Problem solving
Problem
programmer
12
machine language
compiler
interpreter
high level languages
QBasic, C,C++,Java,VB.NET
programmer
natural languages
Turkish English
13
What CPU does





Reading data or instructions from main memory
Performing aritmetic operations
 Addition, multiplication , division,…
Performing logical opertations
Comparing numbers
 They are equal, one is lsss then the other
Moving results of operation back to main
memory
14
Steps of Software Development






Problem definition
Analysing the problem
Development of algorithm, pseudocode and flow
chart
Programming
Testing the program
Implementing
15
The text books


Java How to Program, 8th or higher Editions
 Late Object Version
 by Deitel & Deitel
 Pearson
Starting out with Programming Logic and Design
 2ed Eddition
 by Tony Gaddis
 Pearson
16
Version of Java



Java 2 Enterprise Edition (J2EE)
Java 2 Micro Edition (J2ME)
J2SE Development Kit (JDK)
17
Two Styles of Programming


Structured programming MIS 131
 Introduce structured programming with a pure object
oriented language Lava
Object oriended programing MIS 132
 Basic object oriented programming
 Object oriented capabilities of Java
18
History of Java

Java
by Sun Microsystems in 1991
team leader: James Gosling
 Originally for intelligent consumer-electronic
devices
 Then used for creating Web pages with
dynamic content

Now also used for:



Develop large-scale enterprise applications
Enhance WWW server functionality
Provide applications for consumer devices (cell
19
Download