Upload
hakeem-hoad
View
220
Download
0
Embed Size (px)
Citation preview
7/25/2019 Programming 1_Lecture 1
1/19
Lecture 1
Introduction to Programming
1
Programming 1
7/25/2019 Programming 1_Lecture 1
2/19
Outline
2
Module Overview MOODLE & Enrolment Key
Syllabus / Schedule Outline
Introduction to Programming
A Simple Example Introduction to QBasic
Data Variables and Constants Commands for our pseudocode and equivalents in QBasic Syntax for our pseudocode and equivalents in QBasic
Mathematical Calculations Functions
More Example(s)
7/25/2019 Programming 1_Lecture 1
3/19
Module Overview
3
The Big Picture! (Programming as a component of Computing) This module is primarily designed to help the student develop the
problem solving skills required for building software.
Programming is useless without problem solving
GIGO
First we focus on problem solving by algorithm development and we usesome tools to help us with that: Lecture/Tutorial: Pseudocode and Flowcharts for algorithms Lecture/Tutorial: Tracetables for testing In the Lab: Write QBasic code for some of our algorithms to help bring our
solutions to life In the Lab: Flowrunner to help with our flowcharting skills
Once we have learned the constructs that we need we focus on anintroduction to C programming for the last 3 weeks of the module
Success in the Module
7/25/2019 Programming 1_Lecture 1
4/19
MOODLE
4
utechonline.utech.edu.jm
Faculty of Engineering & Computing
School of Computing & Information Technology
Programming 1
Enrolment key
7/25/2019 Programming 1_Lecture 1
5/19
Introduction to Programming
5
System Development Life Cycle (SDLC) Is a series of well-defined steps that should be followed when a
system is created or being changed.
Represents the big picture of what happens during system
creation or modification.
7/25/2019 Programming 1_Lecture 1
6/19
The SDLC contd.
6
The System Development Life Cycle is comprised of 6 steps,namely:
Analyze the current system
Define the new system requirements
Design the new system
Develop the new system
Implement the new system
Evaluate the new system
7/25/2019 Programming 1_Lecture 1
7/19
The Program Development Cycle (PDC)
7
The fourth step of the SDLC (Development of the newsystem) is comprised of a series of well-defined steps called
the Program Development Cycle.
A programmer carries out the steps in the PDC.
7/25/2019 Programming 1_Lecture 1
8/19
Steps of the PDC
8
The steps are outlined as follows: Review the input, processing, output and storage requirements
(IPOS)
Develop the logic for the program
Test the logic for correctness
Write the program using a programming language
Test and debug the program
Complete the program documentation
7/25/2019 Programming 1_Lecture 1
9/19
What is a program?
9
A program is an organized list of instructions that, whenexecuted, causes the computer to behave in a predetermined
manner. Without programs, computers are useless.
7/25/2019 Programming 1_Lecture 1
10/19
What is Programming?
10
Programming is the process of instructing the computer toaccomplish a particular task.
It is done with the help of a programming language.
When the program is executed, the instructions will be
converted into machine language, which is the only language
that the computer understands.
Programmer vs. User (Think behind the scenes!)
7/25/2019 Programming 1_Lecture 1
11/19
Languages we will use
11
In this course we will use QBasic and C
These are both high level programming languages
These languages were developed so that one single statement
could be written to accomplish substantial tasks and in so
doing speed up the programming process.
For the computer to understand these languages a translator
program (called an interpreter in the case of QBasic or a
compiler in the case of C) converts them into machinelanguage
7/25/2019 Programming 1_Lecture 1
12/19
Example 1.1 and some points to note!
12
Write a program that accepts any two integer numbers fromthe user and displays the sum of these two numbers.
We need to first write an algorithm
Flowcharts
Pseudocode Each algorithm can be tested using a trace table
Then we will convert this algorithm to a program usingQBasicsimilar to pseudocode; makes it easier for you to
focus on problem solving We will avoid C until we have covered the important
constructs and problem solving skills
7/25/2019 Programming 1_Lecture 1
13/19
Pseudocode
13
BEGIN
DECLARE number1, number2 and sum as integers
PRINT "Please enter the first number"
INPUT number1
PRINT "Please enter the second number"INPUT number2
LET sum = number1 + number2
PRINT number1; +;number2; is; sum
END
7/25/2019 Programming 1_Lecture 1
14/19
Flowchart
14
Start
Declare number1,
number2, sum as
Integer
Print Enter the first
number
Input number1
Print Enter the
second number
Input number2 sum=number1+number2
Print number1, +,
number2, is, sum
Stop
7/25/2019 Programming 1_Lecture 1
15/19
The QBASIC Program
15
Lets run this program using QbasicThe Qbasic code looks like this:
Discussionthe mapping between the QBASIC program and ouralgorithmic solutions
' BEGIN
DIM number1, number2, sum AS INTEGER
PRINT "Please enter the first number"INPUT number1
PRINT "Please enter the second number"
INPUT number2
LET sum = number1 + number2
PRINT number1; "+"; number2; "is"; sum
END
7/25/2019 Programming 1_Lecture 1
16/19
Introduction to QBasic
16
BASIC stands for Beginners All-purpose SymbolicInstruction Code
It was invented in 1963, at Dartmouth College, by the
mathematicians John George Kemeny and Tom Kurtzas. Microsoft version Quick Basic (QBasic)
QBASIC is an interpreter
it reads every line translates it and lets the computer
execute it before reading another.
7/25/2019 Programming 1_Lecture 1
17/19
Features of QBasic
17
It is a user friendly language.
It is a widely known and accepted programming
language.
Language is easy since the variables can be named easilyand uses simple English phrases with mathematical
expressions.
7/25/2019 Programming 1_Lecture 1
18/19
Rules of QBasic
18
All QBasic programs are made up of series ofstatements, which are executed in the order in which
they are written.
Every statement should have at least one QBasiccommand word. The words that QBASIC recognizes are
called keywords.
All the command words have to be written using some
standard rules, which is the syntax associated with thecommand. Syntax is the grammar of writing the statement in a language. Syntax
errors are generated when improper syntax is detected.
7/25/2019 Programming 1_Lecture 1
19/19
Next Class
19
Programming Concepts Memory
Variables
Identifiers etc.
Control Structures
Sequence