MISY 2312: Introductory Programming For Information Systems: Dr. Washah
MISY 2312: Introductory Programming For Information Systems: Dr. Washah
MISY 2312: Introductory Programming For Information Systems: Dr. Washah
MISY 2312:
Introductory Programming
for Information Systems
Dr. Washah
1
Chapter 1
Computers, Programs, and Java
Chapter 1
A Typical PC
3
Chapter 1
4
Chapter 1
The Hardware
CPU Memory
Primary
ALU
Bus Secondary
Control
Unit Bus I/O
Internal Input
Registers
Output
5
Chapter 1
6
Chapter 1
CPU
Internal Registers
ALU
Control Unit
7
Chapter 1
8
Chapter 1
Primary Memory:
Primary memory often is called main
working memory. The reason for this
is that primary, or main, memory is used
To store programs and data while they
are being “worked,” or executed, by
the CPU.
9
Chapter 1
Binary Values
bit 0 or 1
byte 8 bits
kilobyte(KB) 1024 bytes
megabyte(MB) 1,048,576 bytes
gigabyte(GB) 1,073,741,824 bytes
10
Chapter 1
64 MB RAM
Memory Memory
Addresses Contents
(Data)
67,108,863 10010011
67,108,862 10010110
. .
. .
. .
1 11010111
0 10110111
11
Chapter 1
Secondary Memory:
Secondary memory, sometimes called bulk
or mass storage, is used to hold programs
and data on a semi-permanent basis. The
most common types of secondary memory
used in PC systems are magnetic disks and
CDs.
12
Chapter 1
Input:
Input is what goes into the system. Input
devices are hardware devices that provide a
means of entering programs and data into the
system. The major input devices for a PC
system are the keyboard, mouse, and disk
drive.
13
Chapter 1
Output:
Output is what comes out of the
system. Output devices are hardware
devices that provide a means of
getting data out of the system. The
four major output devices with which
you will be concerned are the display
monitor, printer, disk drive, and
modem.
14
Chapter 1
The Software
Computer software can be likened to
the driver of an automobile. Without
the driver, nothing happens. In other
words, the computer hardware by
itself can do nothing. A set of software
instructions that tells the computer
what to do is called a computer
program.
15
Chapter 1
Machine Language
All of the hardware components in a
computer system, including the CPU,
operate on a language made up of
binary 1’s and 0’s. A CPU does not
understand any other language.
16
Chapter 1
Assembly Language
Assembly language employs
alphabetic abbreviations called
mnemonics that are easily remembered
by you, the programmer. For instance,
the mnemonic for addition is ADD, the
mnemonic for move is MOV, and so
forth.
17
Chapter 1
High-Level Language:
A high-level language consists of
instructions, or statements, that are
similar to English and common
mathematical notation. When
programming in a high-level language, you
do not have to concern yourself with the
specific machine language of the CPU.
Rather, you can concentrate on solving
the problem at hand.
18
Chapter 1
Operating Systems
An operating system, or OS, is the
“glue” that binds the hardware to the
application software. Actually, an
operating system is a collection of
software programs dedicated to
managing the resources of the
system.
19
Chapter 1
What is Java
• Java is a simple and yet powerful object
oriented programming language and it is
in many respects similar to C++. Java
originated at Sun Microsystems, Inc. in
1991
23
Chapter 1
Java is a Platform
Java (with a capital J) is a platform for
application development. A platform is a
loosely defined computer industry
buzzword that typically means some
combination of hardware and system
software that will mostly run all the
same software. For instance PowerMacs
running Mac OS 9.2 would be one
platform.
24
Chapter 1
Computer programs are very
closely tied to the specific
hardware and operating system
they run. A Windows program
will not run on a computer that
only runs DOS. A Mac
application can't run on a Unix
workstation. VMS code can't
be executed on an IBM
mainframe
25
Chapter 1
2) Java application run inside a Java Virtual Machine and now all
major operating systems are able to run Java including Windows,Mac
OS and UNIX. java application runs on all java platforms
4) Java is also secure. Only Java applications that have permission can
access the resources of the main computer. This means that the main
computer is protected from virus attackers and hackers.
28
Chapter 1
Language Translation
29
Chapter 1
30
Chapter 1
Compilers, Interpreters and
the Java Virtual Machine
Machine language consists of very simple instructions
that can be executed directly by the CPU of a
computer as it computes, retrieves and stores simple
binary numbers. Almost all programs, though, are
written in 'high-level languages' such as Java, Pascal
or C++. A program written in a high-level language
cannot be run directly on any computer. First, it has to
be translated into machine language. This translation
is carried out by a program called a compiler.
31
Chapter 1
Compilers
A compiler takes a high-level-language
program and translates it into an executable
machine-language program (translates the
program all at once). Once the translation
is done, the machine-language program can
be run any number of times, but of course
it can only be run on one type of computer
(since each type of computer has its own
machine language). If the program is to run
on another type of computer it has to be re-
translated, using a different compiler, into
the appropriate machine language 32
Chapter 1
Interpreters
There is an alternative to compiling a high-
level language program. Instead of using a
compiler, which translates the program all at
once, you can use an interpreter, which
translates it instruction-by-instruction, as
required.
purpose: they can let you use a machine-
language program meant for one type of
computer on a completely different type of
computer, thus performing a last moment
translation service
33
Chapter 1
The Java Virtual Machine
The designers of Java chose to use a
combination of compilation and
interpretation. Programs written in Java
are compiled into machine language, but it
is a machine language for a computer that
doesn't really exist. This so-called
"virtual" computer is known as the 'Java
Virtual Machine'. The machine language
for the Java virtual machine is called 'Java
Bytecode'.
34
Chapter 1
Cont.
35
Chapter 1
36
Chapter 1
Enter/edit the Java program
Save
Java Fail
Correct errors
Compiler
Success
Java Bytecode
Interpreter
Machine Language
Instructions Data for the Program
Program Output
37
Chapter 1
38
Chapter 1
Object-oriented programming
(OOP)
39
Chapter 1
1 /*
2 HelloWorld.java Hello World!
3 *
4 Created on April 23, 2002, 7:47 AM
5 *
6 @author Andrew C. Staugaard, Jr. Block comment
7 @version 1.0
8 */
9
10 Import StaugIO class Line comment
11 import staugIO.StaugIO; //FOR INPUT/OUTPUT METHODS
12
13 public class HelloWorld
14 {//BEGIN CLASS
15
16 public static void main (String args[]) Application class
17 {//BEGIN main()
18 StaugIO io = new StaugIO();
19
Method main()
//DEFINE INPUT/OUTPUT OBJECT
Create io object
Use object to call
method 40
Chapter 1
41