0% found this document useful (0 votes)
27 views16 pages

revised notes chapter 1

The document provides an introduction to programming, covering key concepts such as programs, programming languages, algorithms, flowcharts, and pseudocode. It outlines the program development cycle and the importance of structured programming. Additionally, it includes examples of flowcharts and pseudocode for practical applications like a cash register program.

Uploaded by

nnteja1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views16 pages

revised notes chapter 1

The document provides an introduction to programming, covering key concepts such as programs, programming languages, algorithms, flowcharts, and pseudocode. It outlines the program development cycle and the importance of structured programming. Additionally, it includes examples of flowcharts and pseudocode for practical applications like a cash register program.

Uploaded by

nnteja1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Introduction To

Design,
Programming,
Testing.
Chapter 1
Begin with some clicks ….

https://www.youtube.com/watch?v=QvyTEx1wyOY
https://www.youtube.com/watch?v=I-EwobCl0ik
Programs

A program is a set of step-by-step


instructions that directs the computer
to do the tasks you want it to do and
produce the results you want.
Programming Languages

A programming language is a set


of rules that provides a way of
telling a computer what operations
to perform.
What Can a Program Do?

A program can only instruct a computer to:


Read Input
Sequence
Calculate
Store data
Compare and branch
Iterate or Loop
Write Output
Programs are Solutions
to Problems

Programmers arrive at these solutions by using one or more


of these devices:

• Algorithm - Algorithm can be defined as: “A sequence of


activities to be processed for getting desired output from a
given input.”
• Logic flowcharts- Graphically depicts the logical steps to
carry out a task and shows how the steps relate to each
other.
• Pseudocode - Uses English-like phrases to outline the
program
• Structured Programming
Algorithms

Problem 1: Find the area of a Circle of radius r.


Inputs to the algorithm: Radius r of the Circle.
Expected output: Area of the Circle

Algorithm:
Start1: Start
Step2: Read input the Radius r of the Circle
Step3: Area PI*r*r // calculation of area
Step4: Print Area
Step 5: End
Logic Flowcharts

These represent the flow of


logic in a program and help
programmers “see” program
design.
Common Flowchart Symbols

Common Flowchart Symbols

Terminator. Shows the starting and ending points of the


program. A terminator has flowlines in only one direction,
either in (a stop node) or out (a start node).
Data Input or Output. Allows the user to inputdata and results to be displayed.

Processing. Indicates an operation performed by the computer, such as a variable


assignment or mathematical operation.
Decision. The diamond indicates a decision structure. A diamond always has two
flowlines out. One flowlineout is labeled the “yes” branch and the other is labeled the
“no” branch.
Predefined Process. One statement denotes a group of previously defined statements
For instance, “Calculate m!” indicates that the program executes the necessary comma
to compute m factorial.
Connector. Connectors avoid crossing flowlines, making the flowchart easier to read.
Connectors indicate where flowlines are connected. Connectors come in pairs, one wit
a flowline in and the other with a flowline out.

Off-page connector. Even fairly small programs can have flowcharts that extend seve
pages. The off-page connector indicates the continuation of the flowchart on another
page. Just like connectors, off-page connectors come in pairs.
Flowline. Flowlines connect the flowchart symbols and show the
sequence of operations during the program execution.
Example of Flowchart for a
Cash Register Program

Start

sum=0

Input price

sum=sum+price

Yes More
items?

No
tax=sum x 0.0725
total=sum+tax

Output sum, tax,


and total

Stop
Psuedocode

This device is not visual but is considered a “first draft” of the actual
program.
Pseudocode is written in the programmer’s native language and
concentrates on the logic in a program—not the syntax of a
programming language.
Pseudocode for a
Cash Register Program

sum=0
While More items do
Input price
sum=sum+price
End While
tax=sum x 0.0725
total=sum+tax
Output sum, tax, total
Structured Programming

Structured program languages lend themselves to flowcharts,


structure charts, and pseudocode.
Structured programming languages work best where the
instructions have been broken up into small, manageable parts.
The Program Development Cycle

Analyze the problem

Design the solution


algorithm

Design the user


interface

Write the code

Test and debug the


program
Complete the
documentation
Levels of Programming Languages

Machine language
Assembly Language
High Level Languages
Fourth Generation Languages (4GL)
URL’s for free Flowcharting software

www.smartdraw.com
www.gliffy.com/uses/flowchart-software/
www.breezetree.com/flowcharting-software/
Flowchart Software, FREE Flowchart Examples
and Templates ...
www.edrawsoft.com/flowchart.php

16

You might also like