+ All Categories
Home > Documents > PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a...

PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a...

Date post: 04-Jan-2016
Category:
Upload: job-horn
View: 214 times
Download: 0 times
Share this document with a friend
20
PROGRAMMING
Transcript
Page 1: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

PROGRAMMING

Page 2: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

Objectives

• Define the term program

• List and explain the steps involved in developing a

program

Page 3: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

Introduction

How are instructions given to the computer?

Computer programs – finite set of precise instructions written in a computer language

Before program is written we must find a way to solve the problem

After figuring out how to solve the problem we then translate the solution into a language meaningful to the computer

Page 4: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

Introduction

• Giving precise, unambiguous instructions is not inherent in human nature

• Consider the following: Proceed a mile or so down the road until you reach the roundabout. Turn left at the roundabout and follow the road until you reach a green house on the right hand side. The Post office is about the 3rd or 4th building on the right after the green house. You can’t miss it!

Page 5: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

Introduction

Examples of everyday problems:

Write a recipe for making a cheese sandwich

Write instructions to teach your mom how to retrieve voice message from a generic cell phone

Write instructions to give directions to a visitor to get to the nearest hospital, starting from the school premises

Write instructions to tell your grandparent how to download music from the Internet.

Page 6: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

Problem solving on the Computer

1. The design of any computer program involves two phases:

1. The Problem-solving Phase2. The Implementation Phase

Page 7: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

The Problem Solving Phase

1. Define the problem

2. Analyze the problem

3. Develop an algorithm or method for solving

the problem

4. Choose a programming language

Page 8: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

The Implementation Phase

1. Write the computer program which

implements the algorithm in the chosen

programming language

2. Test and debug the program

3. Document the program

4. Maintain the program

Page 9: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

PROBLEM SOLVING PHASE

Phase One

Page 10: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

Defining the Problem

• Stating exactly what the program must do or achieve.

Defining the problem is the first step towards finding a solution. It helps the programmer to understand what is given and

what is required.

If the programmer does not fully understand what is required, he/she cannot produce the desired solution to the problem

Page 11: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

1. Calculate and print the sum of two numbers.

2. Compute the average Age of a class

3. Grade the scores of students in an examination

4. Calculate the amount due for an item based on the

quantity purchased and the price.

5. Calculate and print the revenue made by a minibus

which made 20 trips from Castries to Gros Islet. Each

passenger paid $1.50. If the revenue for the day

exceeded $500 a bonus of 10% of the revenue is given

to the driver. Compute the bonus amount.

Page 12: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

Analyze the Problem

• In order to find a solution to a problem each operation must be identified together with the sequence of performing them.

• The process of finding out the operations is known as analyzing the problem. This involves:– Ensuring that there is the clearest possible understanding of

it.– Determining the general requirements such as what input is

needed, processing required, output needed and storage required.

– Consider alternative solutions

Page 13: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

Develop an Algorithm

• An algorithm is a set of instructions which if followed will produce a solution to a given problem or perform a specified task.

• The instructions in the algorithm must be written in a form the computer can understand. Computer program instructions fall into three main categories:– Input instructions: used for supplying data from the

outside world to a program– Processing instructions: used for manipulating data

inside the computer- to add, subtract, multiply, and divide, compare values.

– Output instructions: used for getting instructions out of the computer

Page 14: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

Choose the Appropriate Programming Language

• In order to write a program a suitable

programming language must be chosen.

• A program is a set of instructions written in a

particular programming language which when

executed will produce a solution to a given

problem or perform a specified task.

Page 15: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

The main difference between an algorithm and a

program is that an algorithm can be written in

informal language without having to follow

special rules whereas the program is written in a

programming language and must follow all the

syntax rules of the language.

Page 16: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

• A program written in Pascal is referred to as a

source program or source code, because

Pascal is a high level language.

• Other high level languages include Fortran

(Formula Translation), COBOL (Common

Business Oriented Language), BASIC

(Beginner's All-purpose Symbolic Instruction

Code) and C.

Page 17: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

• However computers are built to execute

instructions written in what is called machine

language.

• In machine language everything is expressed

in terms of the binary number system – 1’s

and 0’s.

• Machine language is considered a low level

programming language.

Page 18: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

Therefore even programs written in a high level

language must be translated into machine

language so that the computer can understand.

Compilers are used to translate high level

languages into machine language.

Page 19: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

Questions

1. What makes it possible to do a variety of

things on a computer?

2. Computers can execute instructions written in

what language?

3. Describe the steps which must be performed

for a problem to be solved by a computer?

4. Distinguish between an algorithm and a

program.

Page 20: PROGRAMMING. Objectives Define the term program List and explain the steps involved in developing a program.

Template Provided By

www.animationfactory.com

500,000 Downloadable PowerPoint Templates, Animated Clip Art, Backgrounds

and Videos


Recommended