0% found this document useful (0 votes)
9 views13 pages

Chapter 1

Uploaded by

mahmoudezat507
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)
9 views13 pages

Chapter 1

Uploaded by

mahmoudezat507
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/ 13

Programming 1

Chapter 1:
Introduction to Programming

Dr/ Mahmoud Gamal


1
Course Outlines:
• Chapter 1: Introduction to Programming.
• Chapter 2: Introduction to Java Programming.
• Chapter 3: Controlling Program flow.
• Chapter 4: Methods.
• Chapter 5: Arrays.

2
What is Programming?
Programming is a process of problem solving.
Program Development Life Cycle?
Step 1: Analyze the problem
• Understand the overall problem.
• Define problem requirements
➢Does program require user interaction?
▪ If yes, what is the input?
➢What is the expected output?
• Design steps (algorithm) to solve the problem.
Algorithm:
Step-by-step problem-solving process.
3
Step 2: Implement the algorithm
• Implement the algorithm in code.
• Verify that the algorithm works.
Step 3: Maintenance
• Use and modify the program if the problem domain
changes.

Note:
• If the problem is complex, divide it into sub-problems.
• Analyze each sub-problem as above.

4
Example:
Write a program to find the area of rectangle.

area = length * width

• Input:…………..>> length, width


• Processing: …….>> area = length * width
• Output: ………..>> print out the area.

5
The Language of a computer:
Machine Language:
• Language of a computer.
Binary digit (bit):
• The digit 0 or 1
Binary code:
• A sequence of 0s and 1s

6
The Evolution of Programming Languages:
Programming Language:
• It is a set of rules used to write a program.
❑ Low-Level Languages.
➢Machine Language
➢Assembly Language
❑ High-Level Languages.
• In order to write a program using a programming
language you need:
➢ An application named Integrated Development
Environment (IDE). The IDE helps you to write the
program and correct the errors.
➢ An application to transform the program into machine
language (Assembler or Compiler)
7
The Evolution of Programming Languages:
1- Machine Language (Low-level language):
• Early computers were programmed in machine language.
Example:
• To calculate wages = rate* hours in machine language:
➢100100 010001 // Load
➢100110 010010 // Multiply
➢100010 010011 // Store

8
The Evolution of Programming Languages:
2- Assembly Language:(Low-level language):
• Assembly language instructions are mnemonic.
Assembler:
• Translates a program written in assembly language into
machine language.

9
Examples of instructions in Assembly Language and
Machine Language:
Assembly Language Machine Language
LOAD 100100
STORE 100010
MULT 100110
ADD 100101
SUB 100011

10
Assembly Language-Low Level:
Limitations:
• Each processor type has its own Assembly language.
• You must be fully aware of the processor design.
• Very detailed and needs long time and big effort to write.
Advantages
• Programs written using it executes faster.

11
The Evolution of Programming Languages:
3- High Level Languages:
• Its commands are English like (e.g., print, input, copy)
• High-level languages include Basic, C, C++, C#, and
Java.
Compiler:
➢Translates a program written in a high-level language
into machine language
Example:
• The equation wages = rate * hours can be written in Java
as:
➢ wages = rate * hours;

12
The Problem Analysis - Coding – Execution Cycle:

13

You might also like