KEMBAR78
Chapter-1 Java | PDF | Computer Programming | Programming
0% found this document useful (0 votes)
13 views35 pages

Chapter-1 Java

Java cc102

Uploaded by

Russell Junio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views35 pages

Chapter-1 Java

Java cc102

Uploaded by

Russell Junio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

An Introduction to

Programming: Chapter 1

Programming A Computer
Chapter Objectives
⚫ Learn about computers
⚫ Explore the hardware and software
components of a computer system
⚫ Learn about the language of a computer
⚫ Learn about the evolution of
programming languages
⚫ Examine high-level programming
languages
Chapter Objectives (Continued)

⚫ Define the terminology used in


programming
⚫ Learn what an algorithm is and explore
problem-solving techniques
⚫ Explain the tasks perform by a
programmer
⚫ Describe the qualities of a good
programmer

3
Introduction

⚫ Computers have greatly affected our


daily lives – helping us complete many
tasks
⚫ Computer programs (software) are
designed specifically for each task
⚫ Software is created with programming
languages
⚫ C++ is an example of a programming
language

4
What is a Computer?
⚫ Computer
⚫ is a machine that manipulates data
according to a set of instructions.
⚫ A programming device that can store,
retrieve and process data
Elements of a Computer System

⚫ A computer has 2 components


⚫ Hardware
⚫ Software

6
Components of a Computer

⚫ Central Processing Unit (CPU)


⚫ Main Memory
⚫ Storage Devices
⚫ Input Devices
⚫ Output Devices
⚫ Peripheral Devices

7
Central Processing Unit

⚫ Control Unit (CU)


⚫ Arithmetic Logic Unit (ALU)
⚫ Program Counter (PC)
⚫ Instruction Register (IR)

9
Central Processing Unit (continued)

10
Main Memory

⚫ Ordered sequence of cells (memory


cells)
⚫ Directly connected to CPU
⚫ All programs must be brought into main
memory before execution
⚫ When power is turned off, everything in
main memory is lost

11
Secondary Storage

⚫ Provides permanent storage for


information
⚫ Examples of secondary storage:
⚫ Hard Disks
⚫ Floppy Disks
⚫ Flash memory
⚫ ZIP Disks
⚫ CD-ROMs
⚫ Tapes

12
Input Devices

⚫ Definition: devices that feed data and


computer programs into computers
⚫ Examples
⚫ Keyboard
⚫ Mouse

⚫ Secondary Storage

13
Output Devices

⚫ Definition: devices that the computer


uses to display results
⚫ Examples
⚫ Printer
⚫ Monitor

⚫ Secondary Storage

14
Software

⚫ Software consists of programs written to


perform specific tasks
⚫ Two types of programs
⚫ System Programs
⚫ Application Programs

15
System Programs

⚫ System programs control the computer


⚫ The operating system is first to load
when you turn on a computer

16
Operating System (OS)

⚫ OS monitors overall activity of the


computer and provides services
⚫ Example services
⚫ Memory management
⚫ Input/output

⚫ Activities

⚫ Storage management

17
Application Programs

⚫ Written using programming languages


⚫ Perform a specific task
⚫ Run by the OS
⚫ Example programs
⚫ Word processors
⚫ Spreadsheets

⚫ Games

18
HISTORY OF
PROGRAMMING
LANGUAGE
EVOLUTION OF PROGRAMMING
LANGUAGES

To build programs, people use languages that


are similar to human language. The results are
translated into machine code, which computers
understand.
Programming languages fall into three broad
categories:
• Machine languages
• Assembly languages
• Higher-level languages
History Of Programming
Languages
⚫ MACHINE LANGUAGE/ MACHINE
CODE
⚫ the most basic language of a computer
⚫ Instructions written in sequence of 0s and
1s
⚫ Every computer directly understands its own
machine language
⚫ A bit is a binary digit, 0 or 1

⚫ A byte is a sequence of eight bits


History Of Programming
Languages
History Of Programming
Languages
⚫ ASSEMBLY LANGUAGE
⚫ Slightly more advanced programming
language
⚫ Assembly languages were developed to make
programmer’s job easier
⚫ In assembly language, an instruction is an
easy-to-remember form called a mnemonic
⚫ Mnemonics are memory aids, alphabetic
abbreviations for instructions.
⚫ Assembler: translates assembly language
instructions into machine language
History Of Programming
Languages
History Of Programming
Languages
⚫ High-level languages make programming
easier
⚫ Closer to spoken languages
⚫ Examples
⚫ Basic - FORTRAN
- COBOL - C/C++
⚫ Java - Pascal
⚫ Ada
What is Programming

⚫ Computer programming (often shortened to


programming or coding) is the process of
writing, testing, debugging/troubleshooting, and
maintaining the source code of computer
programs. This source code is written in a
programming language. The code may be a
modification of an existing source or something
completely new.
Overview of Programming
Programming – Planning or scheduling the
performance of a task or an event
-giving a mechanism the directions to
accomplish a task
Computer Programs – A sequence of instruction
to be performed by a computer
- the directions given to a computer
Computer Programming – The Process of
planning a sequence of steps for a computer to
follow.
Programmers- people who write programs.
What is a Programming
Language?
⚫ A programming language – A set of rules,
symbols, and special words used to construct a
computer program
- is a machine-readable artificial language
designed to express computations that can be
performed by a machine, particularly a
computer.
- can be used to create programs that specify
the behavior of a machine, to express algorithms
precisely, or as a mode of human
communication.
Programming Language
Machine Language – The language, made of
binary coded instructions, that is used directly by
the computer
Compiler – A program that translates a high level
language into machine code
Interpreter – Reads the source code of your
program one line at a time and performs the
specific instruction contained in that line
Source Program – A program written in a high –
level programming language
Programming Language
⚫ The only programming language that a
computer can directly execute is the
primitive instruction set built into it – the
machine language, or machine code
⚫ Example:
⚫ Instruction Name Machine Language Form
Add 1001001
Subtract 0101010
Programming Language

⚫ *** To the compiler, a source program is


just input data. It translates the source
program into a machine language
program called an object program.
Advantage of a high level
language
⚫ *** It allow you to write portable
(machine independent) code. Where you
can use on different machines, whereas
program written in machine language is
not portable from one computer to
another.
How do we write a Program

⚫ To write a sequence of instruction for a


computer to follow, we must go through
a two phase process:

1. Problem – Solving Phase


2. Implementation Phase

+ Maintenance Phase
Programming Process

Analysis and Concrete Solution


Specification (Program)

General Solution Test


(Algorithm)

Maintenance
Verify Phase

Problem Solving Phase

You might also like