Vous êtes sur la page 1sur 19

Chapter I: An Overview of

Computers and Programming


Languages
History of Computers
Abacus: first device known to carry out
calculations.

Pascaline / Pascal Calculator: mechanical


calculating device invented by Blaise Pascal in
1642

Difference Engine: first programmable computer


invented by Charles Babbage in 1822.
Abacus Pascal Calculator

Difference Engine
Mark I: first computer like machine built in 1944
jointly by IBM and Harvard University headed by
Howard Aiken.

Mark I
Elements of a Computer System
Hardware: the tangible parts of a computer
– Central Processing Unit
– Main Memory
– Input / Output Devices
– Secondary Storage
CPU
Main Memory

Secondary Storage

Input Devices
Output Devices
Software: programs written to perform specific
task
– System Programs: controls the computer
– Application Programs: performs specific task

Microsoft Operating System Microsoft Office Word


Language of a Computer
Bit: a binary digit 0 or 1.
Unit Symbol Bits/Bytes
Byte 8 bits
Kilobyte KB 1024 bytes
Megabyte MB 1024 KB
Gigabyte GB 1024 MB
Terabyte TB 1024 GB
Petabyte PB 1024 TB
Exabyte EB 1024 PB
Zettabyte ZB 1024 EB
ASCII Code Table
Evolution of Programming Languages
Machine Language: the most basic computer language
which provides program instructions in bits.

Assembly Language: a low-level programming language.

Mnemonic: an easy-to-remember form of


instruction.

Assembler: a program that translates a program written


in assembly language into an equivalent program in
machine language
Assembly Language Machine Language
LOAD 100100
STOR 100010
MULT 100110
ADD 100101
SUB 100011
Example of Instructions in Assembly Language and Machine Language
High-Level Programming Language: an easier to use
programming language closer to spoken languages.

Compiler: a program that translates instructions


written in java into a bytecode.

Bytecode: intermediate language which will be


interpreted into a particular machine language.

Interpreter: translates each bytecode instruction


into a machine language.
Processing a JAVA Program
Java has 2 types of programs:
– Applications
– Applets

Example JAVA Application

public class helloWorld


{
public static void main (String[] args)
{
System.out.print(“Hello World.”);
}
}
Steps in Processing a JAVA Program
1. You use a text editor to create a program
(Source Program).
2. Verify that the program obeys the rules of
programming.
3. Run the JAVA application program.
4. Execute the JAVA program.
The Problem
Analysis-Coding-Execution Cycle
Programming: a process of problem solving (in
this case, using a computer).

Algorithm: a step-by-step problem-solving


process in which a solution is arrived at in a
finite amount of time.
Problem ACE Cycle
1. Analyze the problem and outline the problem
and its solution requirements.
2. Design an algorithm to solve the problem.
3. Implement the algorithm in a programming
language.
4. Verify that the algorithm works.
5. Maintain the program by using and
improving it, and modifying it if the problem
domain changes.
Problem: Find the Perimeter and Area
of a Rectangle
Algorithm:
1. Get the length of the rectangle.
2. Get the width of the rectangle.
3. Find the perimeter using the equation:
perimeter = (2*length) + (2*width)
4. Find the area using the equation:
area = length * width
5. Display the results.
Problem: Burger Station
Create an algorithm for a Burger Ordering
System. The system will accept the number of
ordered burgers (10$ each), fries(5$ each), and
soda (5$ each). The system will prompt the user
about the total bill the customer has to pay. The
user will input the amount tendered by the
customer and the system will automatically
display the change.
Problem: Grade Calculator
Create an algorithm that computes the grade of
a student as follows:
Quizes = 35%
Class Standing = 20%
Non-Academics = 5%
Major Exam = 40%
100%

Vous aimerez peut-être aussi