CSCI N201: Programming Concepts Copyright ©2005  Department of Computer & Information Science Introducing Programming.

Slides:



Advertisements
Similar presentations
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Advertisements

Lecture 1: Overview of Computers & Programming
Overview of Programming and Problem Solving ROBERT REAVES.
Computers Are Your Future
Introducing Programming a general discussion. What is a Program? Sets of instructions that get the computer to do something Programs may be a few lines.
COSC 120 Computer Programming
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition by Tony Gaddis, Judy Walters,
Chapter 2: Developing a Program Extended and Concise Prelude to Programming Concepts and Design Copyright © 2003 Scott/Jones, Inc.. All rights reserved.
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
Chapter 1 Program Design
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
Programming Logic and Design Fourth Edition, Introductory
CSCI N201: Programming Concepts Copyright ©2005  Department of Computer & Information Science Introducing Object-Oriented Programming (OOP)
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
1 INTRODUCTION TO OOP Objective: Know the difference between functional programming and OOP Know basic terminology in OOP Know the importance of OOP Know.
CS102 Introduction to Computer Programming
© Paradigm Publishing Inc Chapter 12 Programming Concepts and Languages.
Introduction to Computers and Python. What is a Computer? Computer- a device capable of performing computations and making logical decisions at speeds.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: An Introduction to Computers and Programming Prelude to Programming Concepts and Design Copyright © 2001 Scott/Jones, Inc.. All rights reserved.
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
Chapter Introduction to Computers and Programming 1.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Copyright ©2005  Department of Computer & Information Science Introducing Programming.
Chapter 2: Developing a Program Prelude to Programming Concepts and Design Copyright © 2001 Scott/Jones, Inc.. All rights reserved. 1 Chapter 2 Developing.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
INTRODUCING COMPUTER SCIENCE CSCI N341: Client-Side Programming.
Topics Introduction Hardware and Software How Computers Store Data
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Developing a Program.
CIS Computer Programming Logic
Alexandria University Faculty of Science Computer Science Department Introduction to Programming (CS 102) C++ Programminhg.
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming 1.
Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1 October 20, October 20, 2015October 20, 2015October 20,
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 1 February 8, 2005.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Fundamental Programming: Fundamental Programming K.Chinnasarn, Ph.D.
An Object-Oriented Approach to Programming Logic and Design Chapter 1 An Overview of Computers and Logic.
Basic of Programming Language Skill Area Computer System Computer Program Programming Language Programmer Translators.
COMPUTER PROGRAMMING. Computer programming the objective of the module to gain the necessary skills to develop a computer program using one of the high.
What is Programming? A program is a list of instructions that is executed by a computer to accomplish a particular task. Creating those instructions is.
Computer Science Theory & Introduction Week 1 Lecture Material – F'13 Revision Doug Hogan Penn State University CMPSC 201 – C++ Programming for Engineers.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake An Introduction to Programming.
Basic Computer Organization Rashedul Hasan.. Five basic operation No matter what shape, size, cost and speed of computer we are talking about, all computer.
Programming and Languages Dept. of Computer and Information Science IUPUI.
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
Alexandria University Faculty of Science Computer Science Department Introduction to Programming C++
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
Introduction to Computer Programming using Fortran 77.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
Chapter 1: Introduction to Computers and Programming.
 By the end of this lecture, you should …  Understand the three pillars of Object- Oriented Programming: Inheritance, Encapsulation and Polymorphism.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 1: Introduction to Computers and Programming.
Designing and Debugging Batch and Interactive COBOL Programs
ICS103 Programming in C 1: Overview of Computers And Programming
Programming Logic and Design Eighth Edition
Presentation transcript:

CSCI N201: Programming Concepts Copyright ©2005  Department of Computer & Information Science Introducing Programming

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Goals By the end of this lecture, you should … Understand the different types of programming languages.Understand the different types of programming languages. Understand the basic procedures in a program as input, processing and output.Understand the basic procedures in a program as input, processing and output. Understand the importance of variables.Understand the importance of variables. Understand a basic map of the program development cycle.Understand a basic map of the program development cycle.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Computer Components CPU Central Processing UnitCPU Central Processing Unit RAM (Random Access Memory)RAM (Random Access Memory) Mass storage devicesMass storage devices Input devicesInput devices Output DevicesOutput Devices

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Storage Capacities bit – smallest capacitybit – smallest capacity nibble = 4 bitsnibble = 4 bits byte = 2 nibbles = 8 bitsbyte = 2 nibbles = 8 bits –storage for one character 1 kilobyte (KB) = 1024 bytes1 kilobyte (KB) = 1024 bytes 1 megabyte (MB) = 1024 KB1 megabyte (MB) = 1024 KB 1 gigabyte (GB) = 1024 MB1 gigabyte (GB) = 1024 MB

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Software Application SoftwareApplication Software –Word Processors –Database s/w –Spreadsheets –Painting programs –Web browsers, programs System SoftwareSystem Software –Operating Systems WindowsWindows Macintosh OSMacintosh OS UnixUnix LinuxLinux –Drivers Software is comprised of instructions that get a computer to perform a task.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Programming Languages Programming languages allow programmers to code software.Programming languages allow programmers to code software. The three major families of languages are:The three major families of languages are: –Machine languages –Assembly languages –High-Level languages

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Machine Languages Comprised of 1s and 0sComprised of 1s and 0s The “native” language of a computerThe “native” language of a computer Difficult to program – one misplaced 1 or 0 will cause the program to fail.Difficult to program – one misplaced 1 or 0 will cause the program to fail. Example of code: Example of code:

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Assembly Languages Assembly languages are a step towards easier programming.Assembly languages are a step towards easier programming. Assembly languages are comprised of a set of elemental commands which are tied to a specific processor.Assembly languages are comprised of a set of elemental commands which are tied to a specific processor. Assembly language code needs to be translated to machine language before the computer processes it.Assembly language code needs to be translated to machine language before the computer processes it. Example: ADD , Example: ADD ,

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science High-Level Languages High-level languages represent a giant leap towards easier programming.High-level languages represent a giant leap towards easier programming. The syntax of HL languages is similar to English.The syntax of HL languages is similar to English. Historically, we divide HL languages into two groups:Historically, we divide HL languages into two groups: –Procedural languages –Object-Oriented languages (OOP)

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Procedural Languages Early high-level languages are typically called procedural languages.Early high-level languages are typically called procedural languages. Procedural languages are characterized by sequential sets of linear commands. The focus of such languages is on structure.Procedural languages are characterized by sequential sets of linear commands. The focus of such languages is on structure. Examples include C, COBOL, Fortran, LISP, Perl, HTML, VBScriptExamples include C, COBOL, Fortran, LISP, Perl, HTML, VBScript

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Object-Oriented Languages Most object-oriented languages are high- level languages.Most object-oriented languages are high- level languages. The focus of OOP languages is not on structure, but on modeling data.The focus of OOP languages is not on structure, but on modeling data. Programmers code using “blueprints” of data models called classes.Programmers code using “blueprints” of data models called classes. Examples of OOP languages include C++, Visual Basic.NET and Java.Examples of OOP languages include C++, Visual Basic.NET and Java.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Compiling Regardless of the HL Language, all HL programs need to be translated to machine code so that a computer can process the program.Regardless of the HL Language, all HL programs need to be translated to machine code so that a computer can process the program. Some programs are translated using a compiler. When programs are compiled, they are translated all at once. Compiled programs typically execute more quickly than interpreted programs, but have a slower translation speed.Some programs are translated using a compiler. When programs are compiled, they are translated all at once. Compiled programs typically execute more quickly than interpreted programs, but have a slower translation speed.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Interpreting Some programs are translated using an interpreter. Such programs are translated line-by-line instead of all at once (like compiled programs). Interpreted programs generally translate quicker than compiled programs, but have a slower execution speed.Some programs are translated using an interpreter. Such programs are translated line-by-line instead of all at once (like compiled programs). Interpreted programs generally translate quicker than compiled programs, but have a slower execution speed.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Programming Example Simple programming problem: Convert a price from British pounds into Dollars.Simple programming problem: Convert a price from British pounds into Dollars. PseudocodePseudocode Input the price of the item, PoundPrice, in pounds Compute the price of the item in dollars: Set DollarPrice = 1.62 * PoundPrice Write DollarPrice

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Programming Example Translating to Basic:Translating to Basic: INPUT PoundPrice LET DollarPrice = 1.62 * PoundPrice PRINT DollarPrice END

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Input & Variables Input operations get data into the programsInput operations get data into the programs A user is prompted to enter data:A user is prompted to enter data: Write “Enter the price in pounds” Input PoundPrice Computer programs store data in named sections of memory called variables. In the example above, the variable is named PoundPrice. The value of a variable can, and often does, change throughout a program.Computer programs store data in named sections of memory called variables. In the example above, the variable is named PoundPrice. The value of a variable can, and often does, change throughout a program.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Types of Data Numeric DataNumeric Data –Integer data, I.e., whole numbers, –Floating point data – have a decimal point 23.0, -5.0 Character data (alphanumeric)Character data (alphanumeric) –All the characters you can type at the keyboard –Letters & numbers not used in calculations Boolean dataBoolean data –TRUE/FALSE

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Data Processing and Output Set DollarPrice = 1.62 * PoundPrice The above statement is a processing statement. Take the value in the variable PoundPrice, multiply by 1.62, and set the variable DollarPrice to the result of the multiplication.The above statement is a processing statement. Take the value in the variable PoundPrice, multiply by 1.62, and set the variable DollarPrice to the result of the multiplication. Write DollarPrice Output the value in DollarPrice to the monitor.Output the value in DollarPrice to the monitor.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Assignment Operations Set counter = counter + 1 Assignment statements change the value in a variable Take the value of counter, add 1, and store the result back in the same variable.Assignment statements change the value in a variable Take the value of counter, add 1, and store the result back in the same variable.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Arithmetic Operations NameSymbolExampleResult Exponentiation^4^216 Multiplication*16*232 Division/16/28 Addition Subtraction

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Data Hierarchy 1.Parenthesis 2.Exponentiation 3.Multiplication/Division 4.Addition/Subtraction

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Hierarchy of Operations Example 3 * (6 + 2) / 12 – (7 – 5) ^ 2 * 3 ( ) first = 3 * 8 / 12 – 2 ^ 2 * 3^ next = 3 * 8 / 12 – 4 * 3Mult/Div (L to R) = 24 / 12 – 4 * 3Mult/Div (L to R) = 2 – 12Add/Subtr = -10

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Data Output Send information from the program to the screen, or printer, or disk file.Send information from the program to the screen, or printer, or disk file. Write DollarPrice The computer displays the value of the variable DollarPrice to the screen and the cursor goes to the next line.The computer displays the value of the variable DollarPrice to the screen and the cursor goes to the next line.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Data Output Write “The price in Dollars is”, DollarPrice The output looks like this:The output looks like this: The price in Dollars is 162 The text inside the “ ” is output to the user “as is,” and it is the value in the variable that is output.The text inside the “ ” is output to the user “as is,” and it is the value in the variable that is output.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science 2.1The Program Development Cycle

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Programming as Problem Solving Problem solving principles:Problem solving principles: 1.Completely understand the problem 2.Devise a plan to solve it 3.Carry out the plan 4.Review the results Developing a Program:Developing a Program: 1.Analyze the problem 2.Design the program 3.Code the program 4.Test the program An example of programming as problem solving, Brewster’s Thousands follows …

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science 1) Analyze the Problem Brewster’s ThousandsBrewster’s Thousands –The problem: Brewster wants to invest money at a local bank. There are many options such as interest rates, terms of deposit, compounding frequencies. He needs a program to compute, for any given initial investment, the final maturity (value) of the deposit. What are the inputs? (given data)What are the inputs? (given data) What are the outputs? (required data)What are the outputs? (required data) How will we calculate the required outputs from the given inputs?How will we calculate the required outputs from the given inputs?

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science 2) Design the Program Create an outline of the programCreate an outline of the program An algorithm – a step by step procedure that will provide the required results from the given inputs.An algorithm – a step by step procedure that will provide the required results from the given inputs. Algorithm Examples: Instructions on how to make a cake, use the bank’s ATM, etc.Algorithm Examples: Instructions on how to make a cake, use the bank’s ATM, etc.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science 3) Code the Program Once the design is completed, write the program code.Once the design is completed, write the program code. Code is written in some programming language such as BASIC, Pascal, C++, Java, etc. In this course we write code in pseudo- code, developing the skills to be used when studying the specific languages.Code is written in some programming language such as BASIC, Pascal, C++, Java, etc. In this course we write code in pseudo- code, developing the skills to be used when studying the specific languages.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science 4) Testing the program Locate any errors (bugs)Locate any errors (bugs) Testing is done throughout the development cycleTesting is done throughout the development cycle Desk-checking, or code walkthrough is performed to locate errors in the code.Desk-checking, or code walkthrough is performed to locate errors in the code. –Pretend you are the computer and execute your own code. Ultimate test is to run the program to see if the outputs are correct for the given inputs.Ultimate test is to run the program to see if the outputs are correct for the given inputs.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Modular Programming Determine the major tasks that the program must accomplish. Each of these tasks will be a module.Determine the major tasks that the program must accomplish. Each of these tasks will be a module. Some modules will be complex themselves, and they will be broken into sub-modules, and those sub-modules may also be broken into even smaller modules.Some modules will be complex themselves, and they will be broken into sub-modules, and those sub-modules may also be broken into even smaller modules. This is called top-down designThis is called top-down design

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Mapping Modules InputsProcessesOutputs Input Variables: Principal PercentageRate Term Frequency Rate of Interest: Set Rate = PercentageRate/100 Display: Write FinalValue Final Value: Set FinalValue = Principal * (1 + Rate / Frequency) ^ (Frequency * Term)

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Code Modules A module is an independent, self- contained section of code that performs a single task.A module is an independent, self- contained section of code that performs a single task. The main module is the module that drives the application. It “controls” all other modules. Typically, the main module calls other modules in order to have them perform certain tasks.The main module is the module that drives the application. It “controls” all other modules. Typically, the main module calls other modules in order to have them perform certain tasks.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Program Control & Modules When the main module calls another module, program control transfers to the called module. Program control cedes back to the main module when the called module finishes.When the main module calls another module, program control transfers to the called module. Program control cedes back to the main module when the called module finishes.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Main module Display program title and brief description of program Call Input Data Module Call Perform Calculations module Call Output Results Module End Program Input Data module Prompt for Principal, PercentageRate, Term, Frequency Input Principal, PercentageRate, Term, Frequency End module Perform Calculations module Set Rate = PercentageRate / 100 Set FinalValue = Principal * (1 + Rate / Frequency) ^ (Frequency * Term) End module Output Results Module Write Principal, PercentageRate, Term, Frequency Write FinalValue End module

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Hierarchy Chart (HIPO Chart) A HIPO Chart (“Hierarchy of Inputs, Processes & Outputs”) is similar to an organization chart – it shows what modules exist and how they are related.A HIPO Chart (“Hierarchy of Inputs, Processes & Outputs”) is similar to an organization chart – it shows what modules exist and how they are related. It’s a good idea to keep modules short – about 1 page per module.It’s a good idea to keep modules short – about 1 page per module. We will have very small modules while getting comfortable using these tools.We will have very small modules while getting comfortable using these tools.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science HIPO Chart for Brewster’s Thousands Example Main Module Input Data Perform Calculations Output Results

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Coding Coding is done in a specific programming language. In this part of the course, we will use pseudocode. Later, we’ll adapt our pseudocode to write in JavaScript.Coding is done in a specific programming language. In this part of the course, we will use pseudocode. Later, we’ll adapt our pseudocode to write in JavaScript. Coding before finishing a solid algorithm is a lot like putting the cart before the horse and usually spells disaster. Time well-spent in the design phase will head off problems in coding!Coding before finishing a solid algorithm is a lot like putting the cart before the horse and usually spells disaster. Time well-spent in the design phase will head off problems in coding!

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Documentation Internal DocumentationInternal Documentation –Comments explain to the reader the logic and decision processes of the programmer. Comments are ignored by an interpreter or compiler. –Types of comments include code comments, documentation comments & module comments. External DocumentationExternal Documentation –External documentation includes a user’s guide and, typically, a more technical system administrator’s guide.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Testing Most of the work should be done before the phase begins – creating of a testing document.Most of the work should be done before the phase begins – creating of a testing document. Two types of testing:Two types of testing: –Testing for errors –Quality/Usability testing Two phases of testing:Two phases of testing: –Alpha testing (Internal testing) –Beta testing (Testing at the customer site w/ live data)

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Types of Errors Syntax – wrong grammar, i.e., breaking the rules of how to write the languageSyntax – wrong grammar, i.e., breaking the rules of how to write the language –Forgetting punctuation, misspelling keyword –The program will not run at all with syntax errors Logic - the program runs, but does not produce the expected results.Logic - the program runs, but does not produce the expected results. –Using an incorrect formula, incorrect sequence of statements, etc.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Structured Programming A method for designing and coding programs in a systematic, organized manner.A method for designing and coding programs in a systematic, organized manner. It combines the principles of top-down design, modularity and the use of the three accepted control structures of sequence, repetition and selection.It combines the principles of top-down design, modularity and the use of the three accepted control structures of sequence, repetition and selection.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Control Structures Sequence –in sequential order.Sequence –in sequential order. –The simplest of control structures – start at the beginning and continue in sequential order. Selection – selectively execute statementsSelection – selectively execute statements –Called a branch, it requires a condition to determine when to execute statements.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Control Structures Repetition – repeat statements more than onceRepetition – repeat statements more than once –Called a loop, it needs a stop condition, I.e, the program will continue to loop until some condition is met.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Event-Driven Programming In an event-driven program, the flow of control is based on the user’s clicking on menus and buttons, etc. These user actions are called events.In an event-driven program, the flow of control is based on the user’s clicking on menus and buttons, etc. These user actions are called events. Event-driven programming still uses the basic principles of structured programming – program modules, control structures, good programming style, and program testing.Event-driven programming still uses the basic principles of structured programming – program modules, control structures, good programming style, and program testing.

CSCI N201: Programming Concepts Copyright ©2004  Department of Computer & Information Science Questions?

Resources Venit, Stewart. Extended Prelude to Programming: Concepts and Design. Scott/Jones, Inc., 2002.Venit, Stewart. Extended Prelude to Programming: Concepts and Design. Scott/Jones, Inc., 2002.