UNIT 2. Introduction to Computer Programming. COM E 211: Basic Computer Programming UNIT 2. Introduction to Computer Programming Algorithm & Flowcharting.

Презентация:



Advertisements
Похожие презентации
HPC Pipelining Parallelism is achieved by starting to execute one instruction before the previous one is finished. The simplest kind overlaps the execution.
Advertisements

Loops Objectives Students will: 1. Explain what a loop is and describe the three main types of loops used in programming. 1. Дать понятие циклам. И объяснить.
The waterfall model is a popular version of the systems development life cycle model for software engineering. Often considered the classic approach to.
A Bill is a proposal for a new law, or a proposal to change an existing law that is presented for debate before Parliament. Bills are introduced in either.
TCP/IP Protocol Suite 1 Chapter 12 Upon completion you will be able to: Transmission Control Protocol Be able to name and understand the services offered.
The waterfall model is a popular version of the systems development life cycle model for software engineering. Often considered the classic approach to.
Convolutional Codes Mohammad Hanaysheh Mahdi Barhoush.
Business Statistics 1-1 Chapter Two Describing Data: Frequency Distributions and Graphic Presentation GOALS When you have completed this chapter, you will.
Knot theory. In topology, knot theory is the study of mathematical knots. While inspired by knots which appear in daily life in shoelaces and rope, a.
Time-Series Analysis and Forecasting – Part IV To read at home.
© The McGraw-Hill Companies, Inc., Chapter 4 Counting Techniques.
Section 2.1: Use Inductive Reasoning Conjecture: A conjecture is an unproven statement that is based on observations; an educated guess. Inductive Reasoning:
SPLAY TREE The basic idea of the splay tree is that every time a node is accessed, it is pushed to the root by a series of tree rotations. This series.
Operators and Arithmetic Operations. Operators An operator is a symbol that instructs the code to perform some operations or actions on one or more operands.
Sequences Sequences are patterns. Each pattern or number in a sequence is called a term. The number at the start is called the first term. The term-to-term.
Management Information Systems Systems Development Management Information Systems Systems Development.
© 2005 Cisco Systems, Inc. All rights reserved.INTRO v Growing the Network Understanding the Challenges of Shared LANs.
Chap 9-1 Statistics for Business and Economics, 6e © 2007 Pearson Education, Inc. Chapter 9 Estimation: Additional Topics Statistics for Business and Economics.
LEADERSHIP SKILLS. Many years of experience in Exploring have shown that good leadership is a result of the careful application of 11 skills that any.
Parachuting, also known as skydiving, is the activity of jumping from enough height to deploy a fabric parachute and land. Parachuting is performed as.
Транксрипт:

UNIT 2. Introduction to Computer Programming

COM E 211: Basic Computer Programming UNIT 2. Introduction to Computer Programming Algorithm & Flowcharting

COM E 211: Basic Computer Programming Algorithm & Flowcharting Algorithm A list of instruction that carries out a process step by step Flowchart A diagram representing the logical sequence in which a combination of steps or operations is to be performed Is usually a visual representation of an algorithm Types of Flowchart: Program Flowchart Describes graphically in detail the logical operations & steps within a program System Flowchart A graphic representation of procedures involved in converting data or input to data in output form.

COM E 211: Basic Computer Programming Advantages of Flowchart Language independent Enforces user to give attention to significant matters Provides an alternative to the usual narrative description Easier to understand Limitations Do not represent a programming language Cant be viewed as a natural means of communication Certain details often require a long sequence of interconnected symbols Does not convey why a given set of operations is made Do not highlight the important detail since each step receives as much attention in a flowchart as any other.

COM E 211: Basic Computer Programming Flowcharting Symbols Parallelogram --- Input / Output Rectangle --- Processing Diamond --- Decision Small Circle --- On-page Connector Pentagon --- Off-page Connector Arrow Heads --- Flow Direction Indicators Horizontal / Vertical Lines --- Flow Lines Oval --- Terminal

COM E 211: Basic Computer Programming Examples for Sequential The radius of a circle is equal to 1 unit. Make an algorithm and draw a flowchart to compute the corresponding area of the circle and print out the value of the radius and the area. Given three(3) numbers A,B and C. Make an algorithm and draw a flowchart to compute and print out the sum, the average and the product of these values.

COM E 211: Basic Computer Programming Examples for Branching The ABC manufacturing company plans to give a year- end bonus to each of its employees. Make an algorithm and draw a flowchart which will compute the bonus of an employee. Consider the following criteria: If the employees monthly salary is less than 1,000, the bonus is 50% of the salary. If the salary is grater than 1,000, the bonus is 1,000. Print out the name and corresponding bonus of the employee. Given two (2) numbers, x and y. Make an algorithm and draw a flowchart to determine the difference between x and y. If x-y is negative, compute R=x+y; if x-y is zero, compute R=2x+2y; and if x-y is positive, compute R=x*y. Ptint out the values, x, y and R.

COM E 211: Basic Computer Programming Loops and Counter Looping Used when it is desired to make the same calculation of more than one set of data. It consists of repeating a program, or a section of program and substituting new data for each repetition. Counter Is a setup in a program loop to keep track of a number of times the program segment is repeated. The program can then be terminated after the completion of a predetermined number of passes. Steps in Loop Control Initialization The value of counter is initially set equal to zero or one. Test for limit condition Before the logic flow gets out of a loop, a loop terminating condition must first be satisfied. Incrementation Often each loop is executed, 1 is added to the counter. Thus counter reflects the number of times the operation has been performed.

COM E 211: Basic Computer Programming Examples for Looping The initial value of the radius of a circle is equal to one unit and each succeeding radius is one unit greater than the values before it. Make an algorithm and draw a flowchart to compute the area of the circle starting with R=1.0 up to R=5.0, then print out each radius and corresponding area of the circle. Given a set of five (5) numbers that includes both positive and negative data values. Make an algorithm and draw a flowchart to read in these values one at a time and count the number of positive values (including zero value) and the number of negative values found in the set. After the required values are determined, print out these counted values.