Data and Flowcharts Session

Slides:



Advertisements
Similar presentations
COMPUTER PROGRAMMING I Understand Problem Solving Tools to Design Programming Solutions.
Advertisements

Repetition Control Structures School of Business Eastern Illinois University © Abdou Illia, Spring 2003 (Week 9, Friday 3/07/2003)
Understanding the Three Basic Structures
CHAPTER 1: AN OVERVIEW OF COMPUTERS AND LOGIC. Objectives 2  Understand computer components and operations  Describe the steps involved in the programming.
Chapter 1 - An Introduction to Computers and Problem Solving
Chapter 2 - Problem Solving
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 2 - Problem Solving
Session Objectives# 24 COULD code the solution for an algorithm
Chapter 2- Visual Basic Schneider
Program Design and Development
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
Chapter 3 Planning Your Solution
PRE-PROGRAMMING PHASE
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Computer Programming 12 Lesson 2 - Organizing the Problem By Dan Lunney.
DCT 1123 Problem Solving & Algorithms
CIS Computer Programming Logic
Design the program Create a detailed description of program –Use charts or ordinary language (pseudocode) Identify algorithms needed –Algorithm: a step-by-step.
Designing and Debugging Batch and Interactive COBOL Programs Chapter 5.
Creating your first C++ program
Programming Concepts Chapter 3.
Describe the Program Development Cycle. Program Development Cycle The program development cycle is a series of steps programmers use to build computer.
By the end of this session you should be able to...
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
Pseudocode Simple Program Design Third Edition A Step-by-Step Approach 2.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
Chapter 2 - VB 2005 by Schneider- modified by S. Jane '081 Chapter 2 - Problem Solving 2.1 Program Development Cycle 2.2 Programming Tools.
Problem-solving with Computers. 2Outline  Computer System  5 Steps for producing a computer program  Structured program and programming  3 types of.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Algorithms and Pseudocode
P ROGRAMMING L OGIC GWDA123 Sharon Kaitner, M.Ed. Winter 2015: Week 2.
Pseudocode. Algorithm A procedure for solving a problem in terms of the actions to be executed and the order in which those actions are to be executed.
Programming Logic and Design Fourth Edition, Introductory Chapter 2 Understanding Structure.
Programming revision Revision tip: Focus on the things you find difficult first.
Chapter One Problem Solving
ALGORITHMS AND FLOWCHARTS
Understand Problem Solving Tools to Design Programming Solutions
Programming Logic and Design Seventh Edition
Introduction to programming
Chapter 2- Visual Basic Schneider
Programming Logic and Design Eighth Edition
Understand Problem Solving Tools to Design Programming Solutions
Introduction To Flowcharting
Algorithm and Ambiguity
Computer Programming.
ALGORITHMS AND FLOWCHARTS
Designing and Debugging Batch and Interactive COBOL Programs
Unit# 9: Computer Program Development
Program Design Introduction to Computer Programming By:
Understanding the Three Basic Structures
ALGORITHMS AND FLOWCHARTS
Documentation for Developers
Chapter 2- Visual Basic Schneider
Introduction to Algorithms and Programming
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Chapter 2- Visual Basic Schneider
Algorithm and Ambiguity
Data and Flowcharts Session
A programming language
CSC 110 PROGRAMMING LOGIC CHAPTER 2
Data and Flowcharts Session
ICT Gaming Lesson 2.
CSC 110 PROGRAMMING LOGIC CHAPTER 2
WRITING AN ALGORITHM, PSEUDOCODE, AND FLOWCHART LESSON 2.
Programming Logic and Design Eighth Edition
Presentation transcript:

Data and Flowcharts Session Deborah Becker

Agenda The programming process Data hierarchy Assigning values to variable The three basic structures Is my program structured Exercises

Programming Process Understand the problem Plan the logic Code the problem Test the program Put the program into production

Understand the problem! Programs satisfy users needs HR wants a list of employees who have been with the company over five years Understand what the users wants This is the probably the most important step in planning your program. Does HR want a list of full time employees or should the list include part-time as well? Should the list include contract employees? What starting date should be used to begin the query? Do they want only those who worked for the company continuously for five years or should you include those employees that may have taken family leave but returned? The programmer must not make assumptions about what the user wants. What do they want the report to look like? What data should the report include; first and last name, phone, ssn. Is all this data contained in one file or will several files need to be opened? You will need to ask the user for things link print layout and file specification data.

Plan the logic Develop your algorithm This is not the time to worry about the syntax of the language You can test the logic by creating several records to put through your logic structure manually The programming plans each task or step of the program. You also need to determine the execution order of each step. We will use our pseudocode and flowchart tools to help us plan the order of the instructions.

Code the Program This is where the programmer needs to worry about the syntax. If the planning stage was developed successfully the coding step will require less time.

Test and Retest Programs that are free of syntax errors are not necessarily free of logic errors. This step will require a set of test data

Production After the testing produces clean output the program will be ready to place into production Allow the user to use the program Any good user can find any unresolved bug in even the most error free code? Fixing bug problems and modifying the code is called maintenance programming. About half of your will go on to be maintenance programmers and you will become experienced documentation interpreters.

Six Basic Computer Operations Receives Information Outputs Information Performs Arithmetic Assigns value to variables Compares variables Repeat groups of instructions

Data Hierarchy Database File—(User defined type/Class) Record—(Class Instance/object) Field—(Attribute) The individual pieces of data that describe each instance of the file or class. Character Employee Class or file attributes strFirstName strLastName strAddress strPhone strSSN sngSalary

Problem! Write a program to read the instances of an employee class. Print employee class list report of those with 4 or more years of employment. Attributes to collect Name (First and Last) Address (Street, City, State, Zip) Social Security Number Phone Number Years of employment

Step 1 Do you Understand the Problem? Yes No Create your task list Define all the steps needed to solve the problem Don’t worry about the order of the steps until you feel that your list is complete. No Ask the user questions until your know the answer to all your questions. Do you have a copy of the report layout? Task list 1. Start 2. Open employee file 3. Process records while not EOF 4. Read first record 5. If years of employment >= 4 then add to report 6. If years of employment < 4 read next record 7. If end of file = true then Print report 9. Close data file 10. End

Step 2 Put the task in order of operations Construct your flowchart Fill in your task list Fill in your flowchart symbols for each task Construct your flowchart

Step Three Draw the User Interface Draw the objects from the tool box on the user interface that you need to solve the problem Write the object name beside each object Indicate Attribute name if a data file is going to be used REMEMBER CLASS IS ANOTHER NAME FOR DATA FILE ATTRIBUTE IS ANOTHER NAME FOR FIELD Generate Pseudocode, Flowchart

Steps Three cont. Code the problem Use Pseudocode, Flowchart Create project in coding editor When the runtime errors have been eliminated you are ready for step four.

Step Four Create Sample records Create two or three records. Desk check your flow chart to make sure that your data and logic solve the algorithm. Add any needed structure changes. Data records will usually be supplied with the problem definition sheet.

Structures There are three basic structures from which all logic flows Sequences Selection (decisions) Loops (repetition) Diagram a sequence on the boars Diagram a selection on the board Diagram a loop structure on the board

Structures Selection Loop Sequence IF While

Solving Algorithms All problems can be solved using only these three structures They can be combined in infinite ways Each must have one entrance and one exit This make the program structured Attaching the structures end to end is called stacking

Other steps Use your Flowchart Form and write your pseudocode to the right of your flowchart. Remember there are no set rules—this is a tool to help you when you begin to code your solution. Use structured statement form and indentations to make the logic more apparent.

Example Pseudocode Do step A Do Step B If Condition C is true then Do Step D Else Do Step E Endif While condition F is true Do Step G Step a Step b If C Yes No You can have a sequence inside a selection structure or inside a loop. Programs can become very complicated but remember each structure must have one way in and one way out. Step e Step d Yes While F Step g No

Things that will help? Yeah! Your ready to turn on the computer. Completed task list (order your task) Draw your flowchart Desk check your data Does the data flow into and out of your structure correctly? Draw your User Interface and Name your objects Write your pseudocode Yeah! Your ready to turn on the computer.