1 Overview of Programming and Problem Solving Chapter 1.

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.
Overview. What is Computer Programming? It is the process of planning a sequence of steps (called instructions) for a computer to follow. 2 STEP 1 STEP.
Computer Science-I (CSIT121) Dr. Junaid Ahmed Zubairi SUNY at Fredonia Room 210, Fenton ,
This set of slides is provided by the author of the textbook1 Introductory Topics (Continued) l Computer Components l Basic Control Structures l Problem.
Chapter 1: An Overview of Computers and Programming Languages J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program.
1 Chapter 1 Introduction to Object-Oriented Programming.
1 Chapter 1 Overview of Programming and Problem Solving Dale/Weems Slides based on work by Sylvia Sorkin, Community College of Baltimore County - Essex.
This set of slides is provided by the author of the textbook1 Introductory Topics l Computer Programming l Programming Life-Cycle Phases l Creating an.
Chapter 1 Introduction to Object- Oriented Programming and Problem Solving.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
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.
1 Chapter 1 Overview of Programming and Problem Solving Dale/Weems/Headington Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus.
CS 115 Chapter 1 Overview of Programming and Problem Solving.
CS102 Introduction to Computer Programming
1 Chapter 1 Overview of Programming and Problem Solving Slides based on work by Sylvia Sorkin, Community College of Baltimore County - Essex Campus.
1 Author: Nell Dale Chip Weems Mark Headington Published By Higher Education Press Jones and Bartlett Publishers.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
CSE 1340 Introduction to Computing Concepts Class 2.
1 Chapter 1 Overview of Programming and Problem Solving Dale/Weems Slides based on work by Sylvia Sorkin, Community College of Baltimore County - Essex.
What is a Computer ? Computers are Electronic Machines that process (performs calculation and manipulation) Data under the control of Set of Instructions.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
CHAPTER 1 Overview of Programming and Problem Solving.
CISC105 General Computer Science Class 1 – 6/5/2006.
Overview of Programming and Problem Solving. Objectives In this chapter you will: Learn about different types of computers Explore the hardware and software.
Introduction to C++ Programming Language
Chapter 1: An Overview of Computers and Programming Languages
Overview of Programming and Problem Solving Textbook Chapter 1 1.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
Mrs. Ulshafer August, 2013 Java Programming Chapter 1.
1 Chapter 1 Overview of Programming and Problem Solving Dale/Weems/Headington.
Chapter 1 Overview of Programming and Problem Solving Slides based on work by Sylvia Sorkin, Community College of Baltimore County - Essex Campus.
Chapter 1 Overview of Programming and Problem Solving 1.
1 Chapter 1 Overview of Programming and Problem Solving Dale/Weems Slides based on work by Sylvia Sorkin, Community College of Baltimore County - Essex.
1 Chapter 1 Overview of Programming and Problem Solving Slides based on work by Sylvia Sorkin, Community College of Baltimore County - Essex Campus.
Programming in C++ Dale/Weems/Headington Chapter 1 Overview of Programming and Problem Solving.
Chapter 1 Overview of Programming and Problem Solving CS185/09 - Introduction to Programming Caldwell College.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
Chapter 1 : Overview of Computer and Programming By Suraya Alias
A.Abhari CPS1251 Topic 1: Introduction to Computers Computer Hardware Computer components Connecting Computers Computer Software Operating System (OS)
1 Overview of Programming Principles of Computers.
Chapter 1 An Overview of Computers and Programming Languages.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.
1 Structured Programming Arab Academy for Science and Technology CC112 Dr. Sherif Mohamed Tawfik The Course.
Introduction to Programming By: Prof. Muhammad Abu Baker Siddique 2 nd Lecture 1.
Structured programming 1 st stage By Heba.A Raheem Assist Lecturer College of Sciences/Computer Sciences Department.
1 Chapter 1 Overview of Programming and Problem Solving Slides based on work by Sylvia Sorkin, Community College of Baltimore County - Essex Campus.
Cosc175 - lec11 Overview History Hardware Software Software Development Life Cycle Programming Languages Structured Programming Defining the Problem.
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1 Overview of Programming and Problem Solving
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
Chapter 1 Overview of Programming and Problem Solving
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
What is Computer Programming?
Overview History Hardware Software Software Development Life Cycle
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Presentation transcript:

1 Overview of Programming and Problem Solving Chapter 1

2 WHAT IS A COMPUTER AND WHAT DOES IT DO? An electronic machine, operating under the control of instructions stored in its own memory, that can accept data (input), manipulate data according to specified rules (process), produce results (output), and store the results for future use.

3 Components of a Computer System Hardware - the physical components of a computer Software - sets of instructions to solve a task (computer programs).

4 Input Devices Output Devices Central Processing Unit Memory Unit Storage Devices (Auxilliary storage or secondary storage) THE COMPONENTS OF A COMPUTER (computer hardware)

5 Computer Components Arithmetic Logic Unit Control Unit Auxiliary Storage Device Memory Unit ( RAM & Registers ) Central Processing Unit ( CPU ) Input Device Output Device Peripherals

6 Memory Unit is an ordered sequence of storage cells, each capable of holding a piece of information each cell has its own unique address the information held can be input data, computed values, or your program instructions.

7 Memory Organization two circuit states correspond to 0 and 1 bit (short for binary digit) refers to a single 0 or 1. Bit patterns represent both the computer instructions and computer data 1 byte = 8 bits 1 KB = 1024 bytes 1 MB = 1024 x 1024 = 1,048,576 bytes ~ 1 million bytes 1 GB = 1024 X 1024 X 1024 ~ 1 billion bytes

8 Central Processing Unit has 2 components to execute program instructions Arithmetic/Logic Unit performs arithmetic operations, and makes logical comparisons. Control Unit controls the order in which your program instructions are executed.

9 Peripherals are input, output, or auxiliary storage devices attached to a computer Input Devices include keyboard and mouse. Output Devices include printers, video display, LCD screens, speakers, and digital cameras. Auxiliary Storage Devices include disk drives, scanners, CD-ROM and DVD-ROM drives.

10 Personal Computer

11 NETWORKS AND THE INTERNET Network Sharing resources Local area network - LAN Wide area network Modem

12 COMPUTER SOFTWARE Computer programs A series of instructions that tells the hardware of a computer how to perform tasks

13 TYPES OF COMPUTER SOFTWARE System Software Examples: Operating system Utility programs Application Software Examples: Word Processing Software Programs written to solve a task in CSCI 1170

14 What is Computer Programming? It is the process of planning a sequence of steps (called instructions) for a computer to follow. STEP 1 STEP 2 STEP 3...

15 Programming Life Cycle Phases 1 Problem-Solving 2 Implementation 3 Maintenance

16 Phase 1:Problem-Solving ANALYZE the problem and SPECIFY what the solution must do develop a GENERAL SOLUTION (ALGORITHM) to solve the problem VERIFY that your solution really solves the problem

17 Problem Solving Techniques ASK QUESTIONS -- about the data, the process, the output, error conditions. LOOK FOR FAMILIAR THINGS -- certain situations arise again and again. SOLVE BY ANALOGY -- it may give you a place to start. USE MEANS-ENDS ANALYSIS -- Determine the I/O and then work out the details.

18 Sample Problem A programmer needs an algorithm to determine a person’s transaction at a bank. Suppose that the only transactions are processing a check on the person’s account and making a deposit.

19 Bank Transactions Suppose the beginning balance is and a check comes through for Then the new balance is 1000 – 80 = Suppose the beginning balance is and a check comes through for What happens? What happens when the person deposits a certain amount?

20 If the transactions is a deposit, balance = old balance + deposit amount Else if check amount < balance balance = old balance – check amount Else ?? Bank Transactions, In General

21 An Algorithm is... a step-by-step procedure for solving a problem in a finite amount of time.

22 Design for a Bank Transaction Get the transaction type (deposit or check) 1. Get the old balance 2. If the transaction type is deposit, 1. Get the deposit amount 2. Balance = old balance + deposit amount 3. If the transaction type is check, 1. Get the check amount 2. If the check amount < old balance balance = old balance – check amount print the new balance Else print a message saying that there were insufficient funds balance = old balance – check bounce fee send a notice to the customer of NSF

23 Phase 2: Implementation After an algorithm is written, what next? The algorithm is used as a basis for creating a computer program. A computer program is a set of instructions written in a computer programming language.

24 What is a Programming Language? It is a language with strict grammar rules, symbols, and special words used to construct a computer program.

25 Implementation Phase: Test translating your algorithm into a programming language is called CODING TESTING your program means running (executing) your program on the computer, to see if it produces correct results if it does not, then you must find out what is wrong with your program or algorithm and fix it--this is called debugging

26 Phase 3: Maintenance USE and MODIFY the program to meet changing requirements or correct errors that show up in using it maintenance begins when your program is put into use and accounts for the majority of effort on most programs

27 Programming Life Cycle 1 Problem-Solving Phase Analysis and Specification General Solution ( Algorithm ) Verify 2 Implementation Phase Concrete Solution ( Program ) Test 3 Maintenance Phase Use Maintain

28 Programming Languages: Machine Language is not portable runs only on specific type of computer is made up of binary-coded instructions (strings of 0s and 1s) is the language that can be directly used by the computer

29 High Level Languages are portable user writes program in language similar to natural language examples -- FORTRAN, COBOL, Pascal, Ada, Modula-2, C++, Java most are standardized by ISO/ANSI to provide an official description of the language

30 Three C++ Program Stages other code from libraries, etc. other code from libraries, etc. written in machine language written in machine language written in machine language written in machine language written in C++ written in C++ via compilervia linker SOURCEOBJECT EXECUTABLE myprog.cppmyprog.objmyprog.exe

31 Basic Control Structures a sequence is a series of statements that execute one after another selection (branch) is used to execute different statements depending on certain conditions Looping (repetition) is used to repeat statements while certain conditions are met. a subprogram is used to break the program into smaller units

32 SEQUENCE Statement...

33 SELECTION (branch) IF Condition THEN Statement1 ELSE Statement2 Statement1 Statement Statement2 Condition... True False

34 LOOP (repetition) Statement Condition... False True WHILE Condition DO Statement1

35 SUBPROGRAM (function) SUBPROGRAM1... SUBPROGRAM1 a meaningful collection of SEQUENCE, SELECTION, LOOP, SUBPROGRAM

36 Some C++ History 1972 : Dennis Ritchie at Bell Labs designs C and 90% of UNIX is then written in C Late 70’s : OOP becomes popular Bjarne Stroustrup at Bell Labs adds features to C to form “C with Classes” 1983 : Name C++ first used 1998 : ISO/ANSI standardization of C++

37 Computing Profession Ethics copy software only with permission from the copyright holder give credit to another programmer by name whenever using his/her code use computer resources only with permission guard the privacy of confidential data use software engineering principles to develop software free from errors