P ROGRAMMING L OGIC AND D ESIGN S IXTH E DITION Chapter 1 An Overview of Computers and Programming.

Slides:



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

Lecture 1: Overview of Computers & Programming
CHAPTER 1: AN OVERVIEW OF COMPUTERS AND LOGIC. Objectives 2  Understand computer components and operations  Describe the steps involved in the programming.
ICS103 P ROGRAMMING IN C L ECTURE 1: O VERVIEW OF C OMPUTERS & P ROGRAMMING.
Starting Out with C++, 3 rd Edition 1 Chapter 1. Introduction to Computers and Programming.
COSC 120 Computer Programming
Chapter 1 An Overview of Computers and Logic
16/13/2015 3:30 AM6/13/2015 3:30 AM6/13/2015 3:30 AMIntroduction to Software Development What is a computer? A computer system contains: Central Processing.
CIS105 Chapter 1 Theory Review. Page 2 Hardware and Software are the two major components o any computer system Hardware is the set of physical devices.
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,
An Overview of Computers and Logic
An Overview of Programming Logic and Design
Program Development and Programming Languages
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
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
An Overview of Computers and Programming
PRE-PROGRAMMING PHASE
Computers & Logic An Overview. Hardware Hardware is the equipment, or the devices, associated with a computer. For a computer to be useful, however, it.
Tools make jobs easier to do -A computer is a tool used by many professions A computer can do many different jobs because they are programmable - Machine.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Programming Logic and Design Fifth Edition, Comprehensive
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Chapter Introduction to Computers and Programming 1.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
An Overview of Computers and Logic
Introduction to Programming Lecture Number:. What is Programming Programming is to instruct the computer on what it has to do in a language that the computer.
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming 1.
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.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
Design the program Create a detailed description of program –Use charts or ordinary language (pseudocode) Identify algorithms needed –Algorithm: a step-by-step.
An Object-Oriented Approach to Programming Logic and Design Chapter 1 An Overview of Computers and Logic.
Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm.
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.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
1 Program Planning and Design Important stages before actual program is written.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Programming Logic and Design Seventh Edition
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++
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.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
CHAPTER 1 Introduction to Computers and Programming Lecturer: Dept. of Electrical and Electronic Engineering 1.
Chapter 1 Introduction 2nd Semester H
Introduction to Programming and Visual Basic
CSCI-235 Micro-Computer Applications
DDC 1023 – Programming Technique
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Chapter 1. Introduction to Computers and Programming
Chapter 1: Introduction to Computers and Programming
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Chapter 1 Introduction(1.1)
Chapter 2- Visual Basic Schneider
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
ICT Gaming Lesson 2.
ICS103 Programming in C 1: Overview of Computers And Programming
Programming Logic and Design Eighth Edition
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

P ROGRAMMING L OGIC AND D ESIGN S IXTH E DITION Chapter 1 An Overview of Computers and Programming

O BJECTIVES In this chapter, you will learn about: Computer systems Simple program logic The steps involved in the program development cycle Pseudocode statements and flowchart symbols Using a sentinel value to end a program Programming and user environments The evolution of programming models 2 Programming Logic & Design, Sixth Edition

U NDERSTANDING C OMPUTER S YSTEMS Computer system Combination of all the components required to process and store data using a computer Hardware Equipment associated with a computer Software Computer instructions Tell the hardware what to do Programs Instructions written by programmers 3 Programming Logic & Design, Sixth Edition

U NDERSTANDING C OMPUTER S YSTEMS ( CONTINUED ) Programming Writing software instructions Computer hardware and software accomplish three major operations Input Data items enter computer Processing By central processing unit (CPU ) Output 4 Programming Logic & Design, Sixth Edition

U NDERSTANDING C OMPUTER S YSTEMS ( CONTINUED ) Programming language Use to write computer instructions Examples Visual Basic, C#, C++, or Java Syntax Rules governing its word usage and punctuation Computer memory Computer’s temporary, internal storage Volatile 5 Programming Logic & Design, Sixth Edition

U NDERSTANDING C OMPUTER S YSTEMS ( CONTINUED ) Permanent storage devices Nonvolatile Compiler or an interpreter Translates program code into machine language ( binary language ) Checks for syntax errors Program executes or runs Input will be accepted, some processing will occur, and results will be output 6 Programming Logic & Design, Sixth Edition

U NDERSTANDING S IMPLE P ROGRAM L OGIC Program with syntax errors cannot execute Logical errors Errors in program logic Produce incorrect output as a result Logic of the computer program Sequence of specific instructions in specific order Variable Named memory location whose value can vary 7 Programming Logic & Design, Sixth Edition

U NDERSTANDING THE P ROGRAM D EVELOPMENT C YCLE Program development cycle Understand the problem Plan the logic Code the program Use software (a compiler or interpreter) to translate the program into machine language Test the program Put the program into production Maintain the program 8 Programming Logic & Design, Sixth Edition

U NDERSTANDING THE P ROGRAM D EVELOPMENT C YCLE ( CONTINUED ) 9 Programming Logic & Design, Sixth Edition Figure 1-1 The program development cycle

U NDERSTANDING THE P ROBLEM One of the most difficult aspects of programming Users or end users People for whom program is written Documentation Supporting paperwork for a program 10 Programming Logic & Design, Sixth Edition

P LANNING THE L OGIC Heart of the programming process Most common planning tools Flowcharts Pseudocode Desk-checking Walking through a program’s logic on paper before you actually write the program 11 Programming Logic & Design, Sixth Edition

C ODING THE P ROGRAM Hundreds of programming languages are available Choose based on features Alike in their basic capabilities Easier than planning step 12 Programming Logic & Design, Sixth Edition

U SING S OFTWARE TO T RANSLATE THE P ROGRAM INTO M ACHINE L ANGUAGE Translator program Compiler or interpreter Changes the programmer’s English-like high-level programming language into the low-level machine language Syntax error Misuse of a language’s grammar rules Programmer corrects listed syntax errors Might need to recompile the code several times 13 Programming Logic & Design, Sixth Edition

U SING S OFTWARE TO T RANSLATE THE P ROGRAM INTO M ACHINE L ANGUAGE ( CONTINUED ) Figure 1-2 Creating an executable program 14 Programming Logic & Design, Sixth Edition

T ESTING THE P ROGRAM Logical error Use a syntactically correct statement but use the wrong one for the current context Test Execute the program with some sample data to see whether the results are logically correct Programs should be tested with many sets of data 15 Programming Logic & Design, Sixth Edition

P UTTING THE P ROGRAM INTO P RODUCTION Process depends on program’s purpose May take several months Conversion Entire set of actions an organization must take to switch over to using a new program or set of programs 16 Programming Logic & Design, Sixth Edition

M AINTAINING THE P ROGRAM Maintenance Making changes after program is put into production Common first programming job Maintaining previously written programs Make changes to existing programs Repeat the development cycle 17 Programming Logic & Design, Sixth Edition

U SING P SEUDOCODE S TATEMENTS AND F LOWCHART S YMBOLS Pseudocode English-like representation of the logical steps it takes to solve a problem Flowchart Pictorial representation of the logical steps it takes to solve a problem 18 Programming Logic & Design, Sixth Edition

W RITING P SEUDOCODE Pseudocode representation of a number-doubling problem start input myNumber set myAnswer = myNumber * 2 output myAnswer stop 19 Programming Logic & Design, Sixth Edition

W RITING P SEUDOCODE ( CONTINUED ) Programmers preface their pseudocode with a beginning statement like start and end it with a terminating statement like stop Flexible because it is a planning tool 20 Programming Logic & Design, Sixth Edition

D RAWING F LOWCHARTS Create a flowchart Draw geometric shapes that contain the individual statements Connect shapes with arrows Input symbol Indicates input operation Parallelogram Processing symbol Processing statements such as arithmetic Rectangle 21 Programming Logic & Design, Sixth Edition

D RAWING F LOWCHARTS ( CONTINUED ) Output symbol Represents output statements Parallelogram Flowlines Arrows that connect steps Terminal symbols Start/stop symbols Shaped like a racetrack Also called lozenge 22 Programming Logic & Design, Sixth Edition

D RAWING F LOWCHARTS ( CONTINUED ) Figure 1-6 Flowchart and pseudocode of program that doubles a number 23 Programming Logic & Design, Sixth Edition

R EPEATING I NSTRUCTIONS After the flowchart or pseudocode has been developed, the programmer only needs to: Buy a computer Buy a language compiler Learn a programming language Code the program Attempt to compile it Fix the syntax errors Compile it again Test it with several sets of data Put it into production 24 Programming Logic & Design, Sixth Edition

R EPEATING I NSTRUCTIONS ( CONTINUED ) Loop Repetition of a series of steps Infinite loop Repeating flow of logic with no end 25 Programming Logic & Design, Sixth Edition

R EPEATING I NSTRUCTIONS ( CONTINUED ) Figure 1-8 Flowchart of infinite number-doubling program 26 Programming Logic & Design, Sixth Edition

U SING A S ENTINEL V ALUE TO E ND A P ROGRAM Making a decision Testing a value Decision symbol Diamond shape Dummy value Data-entry value that the user will never need Sentinel value eof (“end of file”) Marker at the end of a file that automatically acts as a sentinel 27 Programming Logic & Design, Sixth Edition

U SING A S ENTINEL V ALUE TO E ND A P ROGRAM ( CONTINUED ) Figure 1-9 Flowchart of number-doubling program with sentinel value of 0 28 Programming Logic & Design, Sixth Edition

U SING A S ENTINEL V ALUE TO E ND A P ROGRAM ( CONTINUED ) Figure 1-10 Flowchart using eof 29 Programming Logic & Design, Sixth Edition

U NDERSTANDING P ROGRAMMING AND U SER E NVIRONMENTS Many options for programming and user environments 30 Programming Logic & Design, Sixth Edition

U NDERSTANDING P ROGRAMMING E NVIRONMENTS Use a keyboard to type program statements into an editor Plain text editor Similar to a word processor but without as many features Text editor that is part of an integrated development environment (IDE) Software package that provides an editor, compiler, and other programming tools 31 Programming Logic & Design, Sixth Edition

U NDERSTANDING P ROGRAMMING E NVIRONMENTS ( CONTINUED ) Figure 1-12 A C# number-doubling program in Visual Studio 32 Programming Logic & Design, Sixth Edition

U NDERSTANDING U SER E NVIRONMENTS Command line Location on your computer screen at which you type text entries to communicate with the computer’s operating system Graphical user interface (GUI) Allows users to interact with a program in a graphical environment 33 Programming Logic & Design, Sixth Edition

U NDERSTANDING U SER E NVIRONMENTS ( CONTINUED ) Figure 1-13 Executing a number-doubling program in a command-line environment 34 Programming Logic & Design, Sixth Edition

U NDERSTANDING U SER E NVIRONMENTS ( CONTINUED ) Figure 1-14 Executing a number-doubling program in a GUI environment 35 Programming Logic & Design, Sixth Edition

U NDERSTANDING THE E VOLUTION OF P ROGRAMMING M ODELS People have been writing modern computer programs since the 1940s Newer programming languages Look much more like natural language Easier to use Create self-contained modules or program segments that can be pieced together in a variety of ways 36 Programming Logic & Design, Sixth Edition

U NDERSTANDING THE E VOLUTION OF P ROGRAMMING M ODELS ( CONTINUED ) Major models or paradigms used by programmers Procedural programming Focuses on the procedures that programmers create Object-oriented programming Focuses on objects, or “things,” and describes their features (or attributes) and their behaviors Major difference Focus the programmer takes during the earliest planning stages of a project 37 Programming Logic & Design, Sixth Edition

S UMMARY Computer programming Requires specific syntax Must develop correct logic Programmer’s job Understanding the problem, planning the logic, coding the program, translating the program into machine language, testing the program, putting the program into production, and maintaining it Procedural and object-oriented programmers approach problems differently 38 Programming Logic & Design, Sixth Edition