COMPUTER GRAPHICS PACKAGE
Computer graphic packages or software is
a program or collection of programs that
enable a user to manipulate visual images
on a computer.
EXAMPLES OF GRAPHIC PACKAGE
i. Paint
ii. Corel Draw
iii. Instant Artist
iv. Harvard graphics
v. Gimp(GMP)
vi. Logo graphics
vii. Ventura
viii. Adobe Photoshop
ix. Photoshine
[Link] illustrator
Uses of graphic packages (Corel draw)
[Link] is used for drawing
[Link] is used for manipulation of graphics
[Link] for editing pictures
[Link] for painting
[Link] to apply social effects graphics
Features/components of CorelDraw
1. Menu bar: the area containing drop
down menu with command grouped by
category.
2. Property bar: a detachable bar with
commands that relate to the active tool
or objects.
3. Title bar: the area displaying the title
of the currently open drawing
4. Tool bar: the detachable bar that
contain shortcuts to menu and other
command like save new etc.
5. Drawing windows: this is the area
outside the drawing page or printable
page bordered by the scroll bar and
application controls.
6. Drawing page: the rectangular area
inside the drawing windows. It is the
printable area of your work area.
7. Rulers: horizontal and vertical borders
that are used to determine the size and
position of object in a drawing.
8. Colour palette: a detachable bar that
contains colours for quick application of
full colour or outline.
9. Page navigator or court: the area at
the bottom left of the application
window that contains control for
moving pages or adding pages.
10. A detachable bar with tools for
creating, shaping, filling, and modifying
objects in the drawing.
Function of Corel Draw tools
[Link] tool: It is used to select and
transform object
[Link] Tool: It is used to edit the shape
of objects.
c. Knife Tool: It is use to cut through
objects.
[Link] tool: It is used to remove areas
of your drawing
[Link] Tool: Lets you move the display of
the drawing window
f. Free hand: Lets you draw lines and
curves
[Link] Tool: Lets you join two
objects with a line
[Link]: Lets you join rectangles
and squares
i. Eclipse Tool: Lets you draw eclipses and
circles
j. Polygon Tool: The polygon tools let you
draw polygon and stars.
BASIC Programming III (One
Dimensional Array)
An array is a list or collection of variables
that all store the same kind of data.
A one-dimensional array is a linear
collection or arrangement of variables of
the same kind. This means the data is
organized in a single row or column, and
each piece of data (an element) is
accessed using a single number, called a
subscript or index.
How to Create an Array in BASIC
Language
To create an array in BASIC, we use the DIM
(short for DIMension) command. This
command tells the computer to reserve a
specific amount of memory for your array.
The syntax for a one-dimensional array is:
DIM arrayName(n)
Where "n" is a whole number that
represents the highest index you want to
use for the array. It's important to
remember that in many versions of BASIC,
arrays start counting from index 0 (zero-
based indexing).
This means `DIM Score(5)` actually creates
6 memory spaces:
Score(0)
Score(1)
Score(2)
Score(3)
Score(4)
Score(5)
Similarly, `DIM NAME$(10)` will reserve 11
memory locations to store string values
(text), from `NAME$(0)` up to
`NAME$(10)`. The `$` sign indicates a
string array.
Each individual variable within the array
(e.g., `Score(3)` or `NAME$(5)`) is called
an element, and the number inside the
parentheses is its subscript or index.
The syntax for a two-dimensional array
(which organizes data in rows and
columns) is:
DIM arrayName(m,n)
Where "m" represents the highest row
index and "n" represents the highest
column index.
Operations on an Array
a. Input operation: This allows you to
store data into the individual elements of
an array. You can use commands like
INPUT (for user input) or READ (for data
defined within the program).
b. Output operation: You can retrieve
and display the data stored in an array's
elements using commands like PRINT.
c. Arithmetic operation: For arrays
holding numeric values, you can perform
simple to complex mathematical
calculations on their elements (e.g.,
adding two elements, finding an average,
etc.).
Simple One-Dimensional Array
Programs in BASIC Programming
Language
Example 1: Create and access an array
of 10 integers
Solution
REM An array to create and access 10
integers
DIM IN(10)
IN(1) = 10
IN(2) = 11
IN(3) = 12
IN(4) = 13
IN(5) = 14
IN(6) = 15
IN(7) = 10
IN(8) = 11
IN(9) = 12
IN(10) = 13
PRINT IN(5)
PRINT "THE SUM OF IN(2) AND IN(7) IS ";
IN(2) + IN(7)
END
[run] Output:
14
THE SUM OF IN(2) AND IN(7) IS 21
Example 2: Create an array to access
your favourite day of the week
Solution
REM Array to create and access your
favourite day of the week
DIM DAY$(7)
DAY$(1) = "Sunday"
DAY$(2) = "Monday"
DAY$(3) = "Tuesday"
DAY$(4) = "Wednesday"
DAY$(5) = "Thursday"
DAY$(6) = "Friday"
DAY$(7) = "Saturday"
INPUT "Enter the number that corresponds
to your favourite day of the week (1-7): "; n
PRINT "My favourite day of the week is ";
DAY$(n)
END
[run] Example Interaction:
Enter the number that corresponds to your
favourite day of the week (1-7): ? 4
My favourite day of the week is Wednesday
LOOPING
Looping is a powerful programming
concept used to make the computer do
repetitive tasks many times in a fraction of
the time it would take to write out each
step individually. It makes programs more
efficient and shorter.
The most common types of loops used in
BASIC programming language are the
FOR...NEXT loop and the WHILE...WEND
loop.
Review of FOR – NEXT Statement
Example 1: Demonstrating the use of
FOR-NEXT statement
REM This program is to demonstrate the
use of FOR-NEXT statement
FOR I = 1 TO 5
PRINT "The bluntest pen is better than
the sharpest memory"
NEXT I
END
[run] Output:
This program will display "The bluntest pen
is better than the sharpest memory" five
times.
The bluntest pen is better than the
sharpest memory
The bluntest pen is better than the
sharpest memory
The bluntest pen is better than the
sharpest memory
The bluntest pen is better than the
sharpest memory
The bluntest pen is better than the
sharpest memory
Example 2: Write a program to print
the first ten integers.
Solution:
REM program to print the first ten integers
FOR NUM = 1 TO 10
PRINT NUM
NEXT NUM
END
[run] Output:
1
2
3
4
5
6
7
8
9
10
Example 3: Write a program to print:
a. Odd numbers from 1 to 20
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
[run] Output:
Odd numbers from 1 to 20 are:
1
3
5
7
9
11
13
15
17
19
b. Even numbers from 2 to 30 using
FOR – NEXT statement
Solution:
REM program to print even numbers from 2
to 30
PRINT "Even numbers from 2 to 30 are:"
FOR EVEN = 2 TO 30 STEP 2
PRINT EVEN
NEXT EVEN
END
[run] Output:
Even numbers from 2 to 30 are:
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
Example 4: Write a program to add
odd numbers from 1 to 20
Solution:
REM program to add odd numbers from 1
to 20
LET SUM = 0
FOR ODD = 1 TO 20 STEP 2
PRINT ODD
LET SUM = ODD + SUM
NEXT ODD
PRINT "The sum of odd numbers from 1 to
20 is "; SUM
END
[run] Output:
1
3
5
7
9
11
13
15
17
19
The sum of odd numbers from 1 to 20 is
100
Review of WHILE - WEND Statement
Example 1: Demonstrating the use of
WHILE – WEND statement
REM program to demonstrate the use of
WHILE – WEND statement
CLS
LET A = 1
WHILE A < 11
PRINT "Hello World"
A=A+1
WEND
END
[run] Output:
This program will display "Hello World" ten
times.
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Example 2: Write a program to print
the square of even numbers from 6 to
22 using WHILE – WEND Statement
Solution:
REM program to print the square of even
numbers
CLS
LET N = 6
WHILE N < 23
PRINT "The square of "; N; " is "; N * N
N=N+2
WEND
END
[run] Output:
The square of 6 is 36
The square of 8 is 64
The square of 10 is 100
The square of 12 is 144
The square of 14 is 196
The square of 16 is 256
The square of 18 is 324
The square of 20 is 400
The square of 22 is 484
HIGH LEVEL LANGUAGES (HLL)
Definition of Terms
1. Program: A sequence of related
instructions (commands) that tell the
computer how to accomplish a specific
task.
2. Programming: The act of writing
computer programs, performed by
trained individuals called programmers.
3. Computer Language: Any language
used by, or associated with the
computer.
4. Computer Programming
Language: An artificial language used to
control the behaviour of a computer,
serving as a means of communication
between the programmer and the
machine.
5. Syntax: The set of rules governing
how the words and symbols in the
language are written (the grammar of the
language).
6. Semantics: The meaning associated
with each word, command, or expression
in a particular language.
7. High-Level Language (HLL): These
are programming languages that are
closer to human language (English
words, mathematical notation) and are
easier to read and write. They are more
abstract, user-friendly, and portable
across different computer systems.
*Note: Markup languages like HTML are
computer languages but are generally not
classified as programming languages
because they primarily describe structure,
not computational logic.*
Examples of High Level Languages
Some prominent examples of HLLs include:
Python (General purpose, widely used for
data science and web development)
Java (Object-Oriented, used for
enterprise systems and Android apps)
C++ (Object-Oriented, used for game
engines and operating systems)
C (General purpose, used for system
programming)
BASIC (Beginners All-purpose Symbolic
Instruction Code - easy to learn)
FORTRAN (Formula Translation - ideal for
scientific applications)
COBOL (Common Business Oriented
Language - ideal for business
applications)
PASCAL, PROLOG, ALGOL, APL, RPG
Classification of High Level Languages
High Level Language According to Use
a. Scientific/Mathematical: Oriented
towards computational procedures for
solving mathematical and statistical
problems. Examples: FORTRAN, ALGOL.
b. Business Data
Processing: Emphasize capabilities for
maintaining data processing and file
handling. Examples: COBOL.
c. Object-Oriented Programming
(OOP): Program structure is based on
'objects' that contain both data and
procedures (methods). Examples: C++,
Java, Python.
d. General Purpose: Used for a wide
variety of programming tasks and
applications. Examples: C, PASCAL,
Python.
e. Special Purpose: Designed for a
specific domain or task. Examples:
SNOBOL (string manipulation), SQL
(database querying).
f. Visual Programming: Designed for
building graphical user interface (GUI)
applications. Examples: Visual Basic,
Visual C++.
g. Artificial Intelligence (AI): Used to
mimic human intelligence and problem-
solving. Examples: Lisp (List processing),
Prolog (Program Logic).
High-Level Languages According to
the Mode of Execution
a. Interpreted: The source code is
translated and executed line-by-line by
an interpreter without a prior compilation
phase. This process is flexible but
generally slower. Examples: BASIC,
Python, Lisp.
b. Compiled Language: The source
code is transformed entirely into
machine-executable form (object code)
by a compiler before the program can
run. This results in faster execution.
Examples: PASCAL, C, FORTRAN, COBOL.
Features of Some High Level
Languages
High Level
Features
Language
FORTRAN 1. Ideal for scientific and
engineering applications
2. Uses concise mathematical
High Level
Features
Language
notation
1. Ideal for business and
financial applications
COBOL
2. Very "English-like" syntax
(easy to read)
BASIC 1. Interactive and easy for
beginners to learn
High Level
Features
Language
2. Often interpreted
1. Focuses on structured
programming concepts
Pascal
2. Excellent for teaching good
programming habits
C 1. Procedural language (uses
functions/routines)
High Level
Features
Language
2. General purpose, powerful
for system-level tasks
Advantages of High Level Language
(HLL)
1. User Friendly: They use commands
and syntax that resemble human
language, making them easier for
programmers to understand and use.
2. Easier to Learn: Their readability
reduces the time and effort required to
become proficient.
3. Machine Independent: The code can
be run on different types of computers
(platforms) with minimal or no changes,
due to the translation step
(compilation/interpretation).
4. Requires Less Time to
Write: Programmers can write complex
instructions with fewer lines of code.
5. Easier to Maintain and Debug: The
code is structured and readable, making
it simpler to find errors (bugs) and
update the program later.
Disadvantages of High Level Language
(HLL)
1. Slower Execution Speed: They are
much slower to execute than machine or
assembly language because the code
must be translated (compiled or
interpreted) before the CPU can run it.
2. Less Memory Efficient: The
generated machine code is often larger
and less optimized than hand-written
assembly code, making HLLs less
efficient in terms of memory usage.
3. Requires a Translator: A program
cannot run directly on the hardware; it
always requires a separate piece of
software (Compiler or Interpreter) for
translation.
4. Less Control over Hardware: HLLs
hide the details of the computer's
architecture from the programmer, giving
them less fine-grained control over low-
level hardware operations like memory
management and registers.
5. Larger Translator Size: The Compiler
or Interpreter software needed to run the
program can be quite large, requiring
significant storage space and memory.
TOPIC: Data Representations
Introduction to Data Representation
In computer science, data
representation refers to the methods
used to store, process, and transmit
information within a computer system. All
data, whether it's text, numbers, graphics,
or sound, must be converted into a format
that a computer can understand. This
format is the binary system, a sequence
of 0s and 1s.
Methods of Data Representation
1. Bits
A bit is the smallest unit of data in
computing. It is a single binary digit, either
a 0 or a 1. A group of eight bits is called
a byte. A byte is a fundamental unit of
computer storage.
1 Bit = A single 0 or 1
2. Binary Coded Decimal (BCD)
BCD is an acronym for Binary Coded
Decimal. It's a method of using binary
digits to represent each individual decimal
digit from 0 to 9. A decimal digit is
represented by four binary digits (also
known as a nibble).
BCD Table
Decimal BCD (4-bit)
0 0000
1 0001
2 0010
Decimal BCD (4-bit)
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
Decimal BCD (4-bit)
9 1001
Example: Convert 4910 to BCD.
3. EBCDIC
EBCDIC: Stands for Extended Binary
Coded Decimal Interchange Code. This
is an 8-bit scheme developed by IBM,
similar to ASCII but primarily used on IBM
mainframe computers. Each character is
represented by two nibbles (4-bits each),
one for the character class and one for the
specific character.
4. ASCII
ASCII: Stands for American Standard
Code for Information Interchange. It
was one of the earliest and most widely
used schemes. It originally used 7 bits to
represent 128 characters, primarily for
English. An extended version uses 8
bits to represent 256 characters.
Unicode
Unicode: This is the most modern and
widely used standard. It was created to
solve the limitations of ASCII and EBCDIC
by providing a unique number for every
character, regardless of language. It
supports characters from languages all
over the world, including Chinese, Arabic,
and Nigerian languages like Yoruba. UTF-
8 is the most common form of Unicode.