You are on page 1of 30

Computer

Science O.L.
(New Syllabus)

“Everybody should learn to program a computer,


because it teaches you how to think.”
- Steve Jobs
Practical

01
Programming
pt.1
What is programming?
Programming is an important skill in
today's digital age

Process of communicating with computer


to be able to follow list given instruction.

When list of relevant instructions is


grouped to do specific task, it forms a
program
Programmer Client

4 General
phases
Desig Testin
n g

Implementatio
Analysis n
Design
It is phase that helps making
implementation easier.
By following same programming concepts , but
without dealing with complicated syntax (code
grammar)

Pseudocode Flowchart Structure


Diagram
Uses English words and Diagram that designs Breaking down the
mathematical notations the steps of a program system to many
to design the steps of a by using a standard set subsystems in tree
program. of symbols aa joined by shape
lines to show the
direction of flow.
Pseudocode
The closest design type to the real code.
By using English words.
Consists of some keywords that is used to
do specific task.

Structure

Keyword Content
OUTPUT
Screen
Keyword used to print something on
screen
My name is Mohamed
Message Memory

Later

Output
Message
Non-changing statement that you want it to be printed Code
as it is.

OUTPUT “My name is


Output “whatever “ Mohamed”

Don‘t forget the Quotations.


Quick question
Write a program that shows that message Screen
“Programming is Fun”

Programming is Fun
Code

OUTPUT “Programming is
Fun”
DECLARE
Computer depends on memory in all its
operation
DECLARE is a process of reserving
memory for later use through out the
When declaring a memory it is called
program
By stating its name and type variable as you can never expect
what is gonna store until you assign it
and it may change through out the
Variable name program

Whole word(no sentences or


spaces)
Name has always to start by
alphabet (no symbols or
numbers)
It is preferable to always name
the variable meaningful name
depends on its purpose
DECLARE
Variable data
type

Real Integer String Characte Boolean


r
1.2, 1 My name, K, True/False
99.4, 78 ID91828, !,
9.0 9 192828 +,
9

You always have to assign the variable


with its appropriate data type that depends
on how you will use it.
DECLARE
Myna
me
DECLA Name Type String
RE

Screen

Code

DECLARE Myname :
STRING
Myname

INPUT String

Screen
Keyword used to take entry from user and
store it in computer
INPUT is always related to DECLARE ……………I

Code

DECLARE Myname: String


INPUT Memory name
INPUT Myname
Myname

OUTPUT String

Screen
Keyword used to print something on
screen

Message Memory

Output Memory
To show data that stored in specific memory. Code

DECLARE Myname: String


DECLARE Myname: String
Output Memory name
INPUT Myname
INPUT Myname

No quotations. OUTPUT Myname


Quick question
Write a program that take from user his Screen
age and
Print it back in appropriate form

Code
Myname

Operations String

Screen
Computers are capable of doing any
calculation.
Write the equation and assign it to a ……………I

memory to be stored.

Operation is always related to DECLARE

Code

DECLARE Myname: String


Memory name M/N Opr M/N
INPUT Myname
Result
Operations
Numbers
Integer

Result 20 + 10

NUM1 NUM2

20 10

Integer Integer

Memory

Result NUM1 + NUM2


Quick question
Create a program that take a name and a Screen
number from the user which represent
your age and show them in appropriate
way
-( Name is.... age is....)
Code
Quick question
Create program that take two numbers as Screen
an input and print their sum.

Code
Quick question
Design an algorithm that inputs 4 Screen
numbers and calculate its sum

Code
Quick question
Design an algorithm that inputs from the user the
length of two sides of a rectangle and the program Screen
calculates and displays both the perimeter and area of
that rectangle.
-Perimeter of Rectangle = (Length+Width) * 2
-Area of Rectangle = Length * Width
Code
Quick question
Design an algorithm that inputs from the
Screen
user height and base lengths of a triangle
and calculate its area.
Area= ½ x Base x height

Code
Flowchart
It is defined by specific shapes.
Non-declarative language.
It has a start and end point that you have
to mention.
It all about writing pseudocode line but in
shapes.
Flowchart
Quick question
Create a program that take a name and a
number from the user which represent
your age and show them in appropriate
way
-( Name is.... age is....)
Quick question
Create program that take two numbers as
an input and print their sum.
Quick question
Design an algorithm that inputs 4
numbers and calculate its sum
Quick question
Design an algorithm that inputs from the user the
length of two sides of a rectangle and the program
calculates and displays both the perimeter and area of
that rectangle.
-Perimeter of Rectangle = (Length+Width) * 2
-Area of Rectangle = Length * Width
Quick question
Design an algorithm that inputs from the
user height and base lengths of a triangle
and calculate its area.
Area= ½ x Base x height
Graded test
Create program that take two numbers as
Screen
an input and print their sum and their
product.
Pseudocode & flowchart
Code
Next Session

Programming pt.2

HW
THANKS

You might also like