Introduction to programming

Slides:



Advertisements
Similar presentations
Algorithms 10 IST – Topic 6.
Advertisements

CS101: Introduction to Computer programming
CS107 Introduction to Computer Science Lecture 3, 4 An Introduction to Algorithms: Loops.
Chapter 2: Problem Solving
Basics of Computer Programming Web Design Section 8-1.
Tutorial #7 Flowcharts (reprise) Program Design. Introduction We mentioned it already, that if we thing of an analyst as being analogous to an architect,
Programming Fundamentals (750113) Ch1. Problem Solving
Chapter 3 Planning Your Solution
PRE-PROGRAMMING PHASE
Fundamentals of C programming
Original Source : and Problem and Problem Solving.ppt.
CS001 Introduction to Programming Day 5 Sujana Jyothi
Practice and Evaluation. Practice Develop a java class called: SumCalculator.java which computes a sum of all integer from 1 to 100 and displays the result.
Lecture 2: Logical Problems with Choices. Problem Solving Before writing a program Have a thorough understanding of the problem Carefully plan an approach.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
`. Lecture Overview Structure Programming Basic Control of Structure Programming Selection Logical Operations Iteration Flowchart.
Fundamentals of Algorithms MCS - 2 Lecture # 5. Representation of Algorithms (continued) Flowcharts.
Chapter 7 Problem Solving with Loops
Flowchart. a diagram of the sequence of movements or actions of people or things involved in a complex system or activity. a graphical representation.
Flowcharts C++ Lab. Algorithm An informal definition of an algorithm is: a step-by-step method for solving a problem or doing a task. Input data A step-by-step.
Basics of Computer Programming
CS1001 Programming Fundamentals 3(3-0) Lecture 2
CHAPTER 5A Loop Structure
Pseudocode Upsorn Praphamontripong CS 1110 Introduction to Programming
Chapter 5: Control Structure
Introduction To Flowcharting
Basics of Computer Programming
Basics of Computer Programming
Introduction to Computer Programming
Flow Charts What are they good for?.
Web Programming– UFCFB Lecture 16
Yenka Portfolio Level for this topic: Student Name : My Levels
Unit# 9: Computer Program Development
Software Design and Development
Programming Fundamentals (750113) Ch1. Problem Solving
Global Challenge Fitness Friend Lesson 2.
Global Challenge Night Sensor Lesson 2.
SME1013 PROGRAMMING FOR ENGINEERS
Global Challenge Night Sensor Lesson 2.
Introduction to Algorithms and Programming
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Faculty of Computer Science & Information System
ME 142 Engineering Computation I
Global Challenge Night Sensor Lesson 2.
Global Challenge Night Sensor Lesson 2.
Global Challenge Fitness Friend Lesson 2.
SME1013 PROGRAMMING FOR ENGINEERS
Global Challenge Night Sensor Lesson 2.
Data and Flowcharts Session
Introduction to Algorithms - 1
Understanding Problems and how to Solve them by using Computers
Global Challenge Night Sensor Lesson 2.
Global Challenge Fitness Friend Lesson 2.
Global Challenge Fitness Friend Lesson 2.
Global Challenge Night Sensor Lesson 2.
Global Challenge Fitness Friend Lesson 2.
Global Challenge Night Sensor Lesson 2.
Global Challenge Fitness Friend Lesson 2.
Data and Flowcharts Session
Flowcharts and Pseudo Code
ICT Gaming Lesson 2.
Global Challenge Night Sensor Lesson 2.
Global Challenge Fitness Friend Lesson 2.
Data and Flowcharts Session
Global Challenge Night Sensor Lesson 2.
Basic Concepts of Algorithm
Global Challenge Night Sensor Lesson 2.
Global Challenge Fitness Friend Lesson 2.
LOOPS The loop is the control structure we use to specify that a statement or group of statements is to be repeatedly executed. Java provides three kinds.
Presentation transcript:

Introduction to programming Algorithms: introduction to flowchart

Agenda Things to remember. Problem solving process. Algorithms Flowchart and Psudocode Flowchart symbols. Main structures of flowcharts Examples Exercises

Things to remember: Computer is one of the tools that has been used to solve problems in different fields applying the latest technology. Computer solves problems using different programming languages to design and produce suitable solutions(codes).

Problem solving process: Recognize and understand the problem. Accumulate facts. Select appropriate theory. Make necessary assumptions. Solve the problem. Verify results.

In another way:

Steps of program development: Develop an Algorithm and a Flowchart. Write the program in a computer language.(e.g. Java, C#,-----) Enter the program into the computer. Test and debug the program. Run the program, input data, and get the results from the computer.

Algorithms: Definition: “An Algorithm is just a detailed sequence of simple steps that are needed to solve a problem”. Represent algorithms: Using Flowchart and Pseudocode.

Definitions: Pseudocode: Specifies the steps of algorithm using essentially natural language of super imposed control structure. Flowchart: a traditional graphical tool with standardized symbols. Show the sequence of steps in an algorithm. OR “Is a graphical representation of an algorithm”.

Example : Pseudocode Flowchart BEGIN fill a kettle with water boil the water in the kettle put the tea leaves in the pot pour boiling water in the pot END

Flowchart symbols: External sheet will be uploaded with the lecture . Connectors : same page and on another page. Page 1 Page 2

The main structures in flowchart: 1.Sequence:In a computer program or an algorithm, sequence involves simple steps which are to be executed one after the other. The steps are executed in the same order in which they are written In a flowchart, sequence is expressed as: In pseudocode, sequence is expressed as: process 1 process 2 … process n

2. Selection: (binary and multi) Is used in computer programs or algorithms to determine which particular step or set of steps to be executed. Binary selection Multi- way selection No Yes

3. Repetition: Allows for a portion of an algorithm or computer program to be done any number of times dependent on some condition being met. An occurrence of repetition is usually known as a loop. Each loop has a termination condition to stop the repetition, or the obvious outcome is that the loop never completes execution (an infinite loop). The termination condition can be checked or tested: at the beginning and is known as a pre-test loop or at the end of the loop and is known as a post-test loop.

Structure of pre-test repetition: In pseudocode, pre-test repetition is expressed as: WHILE condition is true process(es) ENDWHILE Repetition In flowcharting pre-test repetition is expressed as:

Example: Pre-test Repetition Pseudocode WHILE the train is moving keep wholly within the carriage ENDWHILE Pre-test Repetition Flowchart

Structure of post-test repetition: In pseudocode, post-test repetition is expressed as: REPEAT process UNTIL condition is true Repetition In a flowchart post-test repetition is expressed as:

Example: Pseudocode REPEAT UNTIL fluffy beat the egg whites Post-test Repetition Pseudocode REPEAT beat the egg whites UNTIL fluffy Post-test Repetition Flowchart

What is the output of the following flowchart when the input Num= 10 Example: What is the output of the following flowchart when the input Num= 10 Input: Num <- 10 Enter a Number >> 10 Category A Num = 10 10 > 0 ? => YES Output: “Category A”

What is the output of the following flowchart when the input is Num= 0 Example: What is the output of the following flowchart when the input is Num= 0 Input: Num <- 0 Enter a Number >> 0 Category B Category A Num = 0 0 > 0 ? => NO Output: “Category B” Output: “Category A”

Assignment Will be posted at my academic website under CPIT202 and all the instructions will be clarified Deadline will be next Saturday 15th September by 2:00 PM maximum Printed copy of your assignment should be handed to me with full details of the student(Name-ID-email-class-Hand Over date) Please follow the instructions.