KEMBAR78
Ss 2 Lesson Note Week 1-5 | PDF | Trigonometric Functions | Computer Program
0% found this document useful (0 votes)
45 views30 pages

Ss 2 Lesson Note Week 1-5

This document outlines a Data Processing lesson plan for SS 2 students, covering topics such as Program Development, Algorithms, Flowcharts, and Basic Computer Programming. It includes definitions, characteristics, precautions, stages of program development, and examples of algorithms and BASIC programming language features. The plan also includes practical coding exercises and project work for students.
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)
45 views30 pages

Ss 2 Lesson Note Week 1-5

This document outlines a Data Processing lesson plan for SS 2 students, covering topics such as Program Development, Algorithms, Flowcharts, and Basic Computer Programming. It includes definitions, characteristics, precautions, stages of program development, and examples of algorithms and BASIC programming language features. The plan also includes practical coding exercises and project work for students.
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/ 30

8-10 PALACE ROAD, OGHEGHE COMMUNITY, KM4,

UPPER SILUKO ROAD, BENIN CITY, EDO STATE

DATA PROCESSING LESSON NOTE.

TERM: THIRD TERM (2025)


CLASS: SS 2
INSTRUCTOR: UNCLE CELESTINE
WEEK TOPIC
1. PROGRAM DEVELOPMEN

2. PROGRAM DEVELOPMENT

3. ALGRITHM AND FLOWCHART


4. BASIC COMPUTER PROGRAMING

5. BASIC COMPUTER PROGRAMING 2

WEEK 6-10: PRACTICAL CLASSES

6. INTRODUCTION TO CODING…

7 BASIC TERMS IN COMPUTER CODING

8 WRITING SIMPLE COMPUTER CODES

9 CONTINUATION ON COMPUTER CODING 1

10 CONTINUATION ON COMPUTER CODING 2

11 PROJECT WORK
12 EXAMINATION
Page 2 of 30
WEEK ONE AND TWO

Topic: Program Development


Class: SSS Two

What is a Program?

A program is a set of instructions that are executed by the CPU. A

program can also be defined as an organized list of instructions that

when executed cause the computer to behave in a predetermined

manner. Without a program the computer is useless.

Characteristics of a Good Program


The following are characteristics of a good program:

1. Accuracy: Program should be sufficiently accurate to get the desired

results.

2. Extensibility: this means that you so design the program so that you

can add and remove an element from your program without disturbing

the underlying structure of the program.

3. Maintainability: this is making your code easy to update

4. Efficiency: a good program should be designed to use the least amount


Page 3 of 30
of primary memory and the fewest devices possible.

5. Generality: Design the program to be generalized and flexible, if

possible

6. Portability: a good program can be moved to another environment

7. Simplicity: program logic should be as simple and as uncomplicated as

possible

8. Transferability: plan the program to be as machine independent as

possible.

9. Reusability: write code that will be able to be used in unrelated

projects.

10. Leanness: leanness means making the design with no extra parts.

Precautions in Program Development

There are certain precautions that one should take during the

development of a program. These are:

1. Patience: one should not rush up the programming process, although

deadlines are important that should not be at the expense of a faulty

Page 4 of 30
program.

2. Step Following: all steps of the program should be followed religiously

without skipping any step or there will be erroneous results.

3. Execution order: the order of execution of instructions should be

followed.

4. Fresh mind: One should be sufficiently fresh to work on a program,

being free of any kind of fatigue.

Program Development Stages


Software(Program) development can be divided into several stages as
listed below:
1. Problem Definition
2. Problem analysis
3. Flowcharting
4. Desk checking
5. Program coding
6. Program compilation
7. Testing/Debugging
8. Program documentation
1. Problem Definition: This is the formal definition of task. It includes

specification of inputs and outputs processing requirements, system

constraints and error handling methods.

Page 5 of 30
2. Problem Analysis: this step is the process of becoming familiar with

the problem that will be solved with the computer program.

3. Flowcharting: A flowchart is a pictorial representation in which

symbols are used to show the various operations and decisions to be

followed in solving a problem. Flow chart depicts the logic involved in the

problem solution and therefore, is a step-by-step sequence that the

program will describe to the computer.

4. Desk-checking: Desk-checking is a manual (non-computerized)

technique for checking the logic of an algorithm

5. Program coding: this is the process of transforming the program logic

document into a computer language format.

6. Program compilation: A compiler is a computer program (or a set of

programs) that transforms source code written in a programming

language (the source language) into another computer language (the

target language), with the latter often having a binary form known as

object code. The process of transforming source code into object code is

Page 6 of 30
called compilation.

7. Testing and debugging: This stage is the discovery and correction of

programming errors.

8. Program documentation: Comprehensive information on the

capabilities, design details, features, and limitations of the program so

that those who use and maintain it can understand it so that the program

can be extended to further applications.

Page 7 of 30
WEEK THREE

Algorithm and Flowchart

Class: SSS Two


Definition Algorithm

Algorithm can be defined as a set of rules and sequential steps that

define how a particular problem can be solved in finite and ordered

sequences.

Function of Algorithms

An algorithm generally takes some input, carries out several effective

steps in a finite amount of time, and produces some output.

Characteristics of Algorithms
Every algorithm should have the following five characteristic features

i. Input

ii. Output

iii. Definiteness

iv. Effectiveness

v. Termination
Page 8 of 30
Example1: Write an algorithm to compute the area and circumference of

a cycle given the diameter d. Use the formular A= πr^2 and C=

2πr Solution

Step 1: Start

Step 2: Get the diameter d

Step 3: Compute r=(d/2)

Step 4: Compute A= πr^2

Step 5: Compute C= 2πr

Step 6: Display the results

Step 7: Stop

Example 2: Write an algorithm that tells you how to wash dishes


Solution
Step 1: start
Step 2: scrape food off dishes
Steps 3: wash the dishes with soap and water
Step 4: Rinse the dishes
Step 5: Dry them
Step 6: Stop

Page 9 of 30
Example 3: Write an algorithm to evaluate the equation y = a(b-c)^2/d+2
Solution
The rule of BODMAS is to be followed to effectively evaluate the
equation
Step 1: start
Step 2: Input the values of a, b, c, d
Step 3: The value of y is to be calculated
Step 4: Calculate the value of b-c and denote f
Step 5: Calculate the square of f
Step 6: Multiply f by a and denote g
Step 7: Calculate the value of d+2 and denote h
Step 8: divide h by g
Step 9: We get the value of y
Step 10: Print y
Step 11: Stop
Definition of Flowchart
This is the graphical representation of the steps involved in solving a
given problem. More formally, a flowchart is a pictorial representation in
which symbols are used to show the various operation and decisions to
be followed in solving a problem.
Some standard symbols used in drawing a program flow chart are:
Rules for Drawing Flowchart

i. Every flowchart must terminate, that is, it must have a starting and
ending points.
ii. The Direction of flow should be from left to right or top to bottom.
iii. Maintain consistent spacing between symbols
iv. Use the correct symbol for each step
v. Keep it simple and clear.
Example 1: Draw a flow chart to print the area of a 10cm square

Page 10 of 30
WEEK FOUR

TOPIC: BASIC programming Language

SS 2

Origin of and Features of BASIC


BASIC stands for Beginner’s All-purpose Symbolic Instruction Code. It was

developed in 1960 by John Kemeny and Thomas Kurtz to teach students

at Dartmouth College. It has undergone a series of historical

development, which has resulted in several forms of the language.

BASIC is now in form of VB.NET (Visual Basic.Net). The majority of BASIC

languages use program translators called interpreters to allow the

computer to understand and obey the BASIC statements in the computer

program. Examples of such interpreters are:

BASICA

GwBASIC

Turbo BASIC

Quick BASIC

Page 11 of 30
BASIC Character Set

The characters used in BASIC language include:

i. Alphabetic Characters: BASIC alphabetic characters consist of letters (A

to Z)

ii. Numeric Characters: Numbers from 0 to 9 are used in BASIC language

iii. Special Characters: Special characters are characters that are not

letters or numbers. They include punctuation marks, accent marks, ASCII

control characters, formatting characters. Examples + % ^ # = ( ) etc

BASIC variable

A variable is a quantity that changes during the execution of a program. It

can also be defined as a name that is used to represent some storage

location.

Types of Variables

1. Numeric Variables: These are used to store numeric values such as 23,

98, 1.44 etc. Examples of numeric variables are; N, Y, P, SUM, AVERAGE,

etc

Page 12 of 30
2. String Variables: These are used to store alphabetic and alpha-numeric

values. A string variable name is always written with a dollar sign ($) as

the last character. E.g. Name$, AVG$, X$, etc

Rules for coding variable

i. In BASIC combining alphabets, numbers and the decimal point (a

maximum length of 40 characters) may form a variable.

ii. No reserve word can be used as a variable name.

iii. Special characters cannot be used for naming a variable. iv. A string

variable corresponds to string data whereas a numeric variable

corresponds to numeric data,

v. In a program, each variable is referred to throughout the program by

its name.

Constants

A constant is data that remains the same as the program runs (executes).

Constants are values stored or assigned to variables.

Types of Constants in BASIC


Page 13 of 30
BASIC allows two constants which are;

Numeric constant: Numeric constant in BASIC is any signed or unsigned

number.

Alpha-Numeric or string constant: It consists of the combination of

letters, digits, and other symbols that are treated in a manner completely

analogous to a numeric constant. They are enclosed within inverted

commas.

Rules for numeric constants

i. A number can have a maximum of 8 digits

ii. No comma is allowed

iii. A decimal point can appear anywhere

iv. If the value is quite larger it is expressed in exponent form

v. No blank space, special characters or any other letter is allowed in the

number.

Page 14 of 30
BASIC Expressions and Operators

In programming, an expression can be defined as the combination of

operands and operators. Operands are the data items involved in an

expression. Operators determine the action to be carried out on the

operand in the expression. For instance in the statement: LET C = A + B, A

and B are the operands while “+” is the operator.

There are three major types of expression in BASIC. They are:

Arithmetic expression

Relational Expression

Logical expression

Arithmetic Expression

BASIC arithmetic expression is used to represent mathematical formulae

in BASIC programming. Below is a list of BASIC arithmetic operators:

Arithmetic Operators

Symbol Name Function

^ Upper caret Exponentiation

Page 15 of 30
/ Slash Division

* Asterisk Multiplication

+ Plus Addition

- Minus Substraction

Arithmetic Expression

Every arithmetic expression must appear on a single line. There is no

superscript in BASIC as we find in algebra.

Relational Expression
Relational Expression is used for the comparison of two or more data
items. BASIC relational operators are listed below:
Symbol Name

< Less than

> Greater than

= Equal to

<> Not Equal to

<= Less than or equal to

>= Greater than or equal to

Page 16 of 30
Logical Expression

Logical expression involve is an expression involving two or more

relational repression joined by a logical expression. BASIC logical

operators are:

AND

NOT

OR

Evaluation or Arithmetic Expression

To evaluate an arithmetic expression, the following order is followed:

Priority Operator

1st Parenthesis i.e ( and )

2nd Exponentiation

2nd Exponentiation

3rd Multiplication and Division

4th MOD and INTER Division

5th Addition and Subtraction

Page 17 of 30
Example: evaluate 4*A*B^2+ (A^2*B+C)/(A+B) if A=2; B=4 and c=2

Solution

Step 1 Substituting we have ---- 4*2*4^2+ (2^2*4+2)/ (2+4)

Step 2 evaluate terms in the parenthesis ---- 4*2*4^2+18/6

Step 3 evaluate 4^2 --------- 4*2*16+18/6

Step 4 evaluate 4*2*18 ------- 128+18/6

Step 5 evaluate 18/6 ------ 128 + 3

Step 6 evaluate 128+3 ----- 131

BASIC Statements

LET Statement

The let statement is used to assign a numeric or string value to a variable.

Syntax

LET [variable] = [constant] for numeric value

LET *variable+$ = *“value”+ for string value

Example

LET X = 12

Page 18 of 30
LET B$ = “Clementina”

LET AREA = L*B

INPUT Statement

The INPUT statement is used to enter data into the computer with a user

prompt or a group of variables during program execution.

Syntax for numeric value

INPUT “*prompt+”; *variable+

Syntax for string value

INPUT “*prompt+”; *variable$+

Example

INPUT “type in the number”; A

INPUT “Type in your name”; N$

READ-DATA statement

READ and Data are two statements concerned with each other which are

used to put data in a line of the program and to read the data when it is

needed.
Page 19 of 30
Example

READ A, B, C

DATA 5, 6, 7

LET SUM = A+B+C

PRINT SUM

END

REM (Remark) Statement

The REM statement is used to insert comments or remarks into a BASIC

program. The use of remark statements improves the readability of the

program. REM is a non-executable statement.

Syntax

REM [remark]

Example

REM program to add six numbers

PRINT statement

This statement is used to transmit data from the computer memory to


Page 20 of 30
the output device.

Examples

PRINT A

PRINT “I Like Writing Program”

Program Terminators (END and STOP Statements)

The STOP statement is used to terminate the execution of a program at

any point in the program. The END statement indicates the actual end of

a program. The STOP statement may appear many times and anywhere,

whereas an END statement can only appear at the end of a program and

only once.

Example

REM END statement

PRINT “Good morning”

END

FOR – NEXT

Looping is used to have the computer do repetitive tasks in a fraction of


Page 21 of 30
the time that would otherwise be required. The most common type of

loop used in QBASIC programming is the FOR...NEXT and WHILE WEND

loop that repeats a series of instructions a specified number of times.

Syntax

FOR variable=x TO y [STEP z]

NEXT [variable][,variable...]

x,y, and z are numeric expressions.

STEP z specifies the counter increment for each loop.

Example 1: Write a program using FOR-NEXT state to print any statement

five times Solution

FOR I = 1 TO 5

PRINT “the dullest pencil is better than the sharpest memory”

NEXT I

END

EXAMPLE 2: Write programming using FOR-NEXT statement to display

odd numbers from 1 to 20

Page 22 of 30
Solution

REM program to print odd numbers from 1 to 20

PRINT “odd numbers from 1 to 20 are”

FOR ODD =1 TO 20 STEP 2

PRINT ODD

NEXT ODD

END

Simple Basic Programs

Example 1: Program to find the sum and difference between two number

10 REM this program accepts two numbers and finds their sum and

difference

20 INPUT “Type the first number and press ENTER”; NUM1

30 INPUT “Type the second number and press ENTER”; NUM2

40 LET SUM = NUM1 + NUM2

50 LET DIFF = NUM1 – NUM2

60 PRINT “first number is “; NUM1

Page 23 of 30
70 PRINT “second number is “; NUM2

80 PRINT “================”

90 PRINT NUM1; “+”; NUM1 “=” ; SUM

100 PRINT NUM1; “-“ ; NUM2 “=” DIFF

110 END

Example 2: a program to calculate the area and perimeter of a rectangle

10 REM program to find the area and perimeter of a rectangle

20 INPUT “Type the length of the rectangle”; L

30 INPUT “Type the in the breadth of the rectangle”; B

40 LET AREA = L*B

50 LET PERI = 2 * (L + B)

60 PRINT “The area of the rectangle is “ ; AREA

70 PRINT “The perimeter of the rectangle is” ; PERI

80 END

Page 24 of 30
WEEK FIVE
BASIC Programming II (Built-in Functions)
TOPIC: BASIC Programming II (Built-in Functions)

CLASS: SSS Two

What is a Function
A function is a structure that simplifies a complex operation into a single-
step
Definition of BASIC Built-in Functions
BASIC built-in functions are predefined functions integrated into BASIC
interpreter, that can be used to perform a wide range of operations.
Some BASIC Built-in Functions
BASIC has several built-in functions that greatly extend its capability. They
include the following:
1. CHR$ function
The CHR$ function returns a string containing the character associated
with the specified ASCII (American Standard Code for Information
Interchange). The syntax is CHR$(X). "X" is a whole number in decimal
number system.
Example
PRINT CHR$ (65) returns letter A
PRINT CHR$ (66) returns letter B

2. SQR Function
The SQR function calculates the square root of a number. The general
form of the function is SQR(X)
Example
PRINT SQR(9) will return 3
PRINT SQR(2) will return 1.414214

Page 25 of 30
3. INT Function
The INT function finds the greatest integer less than or equal to a
number. The general form of the function is INT(X)
Example
PRINT INT(15.46) will return 15
PRINT INT(-15.46) will return -16
PRINT INT(15.56) will return 15
PRINT INT(-15.56) will return -16

4. CINT Function
CINT means Integer Conversion. This function is used to convert a
number into an integer. It rounds off the number to the nearest integer
value.
Example
PRINT CINT(15.46) will return 15
PRINT CINT(-15.46) will return -15
PRINT CINT(15.56) will return 16
PRINT CINT(-15.56) will return 16

5. FIX Function
This function truncates the number into an integer. The General form of
the function is FIX (X)
Example
PRINT FIX(15.46) will return 15
PRINT FIX(-15.46) will return -15
PRINT FIX(15.56) will return 15
PRINT FIX(-15.56) will return -15

6. ABS Function
ABS means absolute. It is used to find the absolute value of a number.
The absolute value of a number means the number without any sign. The

Page 26 of 30
general form of the function is ABS(X)
Example
PRINT ABS(+3.4) returns 3.4
PRINT ABS(-3.4) returns 3.4

7. RND Function
RND means random. RND is a special function that gives us a random
number between 0 and 1
Example
PRINT RND
PRIND RND
This program will print RND twice. Notice that you’ll get to numbers that
appear to be unpredictable and random. But, try running the program
again. You’ll get the same random numbers.

8. COS, SIN, TAN, and ATN Function


The COS, SIN, TAN, and ATN trigonometric functions are used to find the
Cosine, Sine, Tangent and Arctangent of a particular numeric expression.
The general form is:
COS(X)
SIN(X)
TAN(X)
ATN(X)

9. MODE Function
It means remainder. This function returns the remainder. The general
form of the function is X MOD Y
Example:
PRINT 16 MOD 5 will return 1
PRINT 30 MOD 5 will return 0

9. SGN Function

Page 27 of 30
It means sign. This returns the sign of the input number in numeric value.
The general form of the function is SGN(X).
Examples
PRINT SGN(54) will return 1
PRINT SGN(-54) will return -1
PRINT SGN(0) will return 0

10. EXP Function


It is used to find the natural exponent of x, where e = 2.718281828. the
general form of the function is EXP(X)
Example
EXP(4) will return 54.59815
EXP(-5) will return 6.737947E-03

LOG Function
This function returns the natural logarithm of a numeric expression (any
positive numeric expression). The syntax is LOG(X)
BASIC Notation
In a BASIC programming language, every arithmetic expression must
appear on a single line. There is no superscript in BASIC as we find in
algebra.
Examples
Mathematics Expression BASIC Expression
x=-b±b2-4ac2a X=(-B±SQR(B^2-4*A*C))/(2*A)
x-yx+y (X-Y)/(X+Y)
ex2+y-Sin(x+ny) EXP(X^2+Y)-SIN(X+N*Y)
b=14ac B=1/(4*A*C)
2x2-3x-1x2-x-6 (2*X^2-3*X-1)/(X^2-X-6)

Some BASIC Programs

Page 28 of 30
Example 1: Write a BASIC program to find the square root of numbers in
a given range
Solution
10 REM program to find the square root of numbers
20 INPUT “Enter the first number of range”; A
30 INPUT “ENTER the last number of range”; B
40 FOR I = A TO B
50 PRINT “the square root of “; A; “is”; SQR(A)
60 NEXT I
70 END

Example 2: Write a program to find the Sine of unknown values


Solution
10 REM Program to find the Sine of unknown value
20 INPUT “Enter the number”; A
30 LET S = SIN(A)
40 PRINT “The Sine of”; A; “is”; S
50 END <

Example 3: Write a program to output letters A - Z


Solution
10 REM this program is written to display letters from A to Z
20 FOR I = 65 TO 90
30 PRINT CHR$(I);
40 NEXT I
50 END

Example 4: Write a program to plot Cosine Graph


Solution
10 REM Program to plot cosine graph
20 SCREEN 13

Page 29 of 30
30 FOR X% = 0 TO 360
40 PSET (X%, (COS(X% * 0.017453) * 50) + 50), 15
50 NEXT X%
60 END

WEEK 6-10 ARE PRACTICAL


CLASSES

Page 30 of 30

You might also like