Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers, Problem Solving, and Programming Problem.

Slides:



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

Lecture 1: Overview of Computers & Programming
CS 330 PROGRAMMING LANGUAGES & SOFTWARE ENGINEERING Dr. Blaise W. Liffick Spring
© 2012Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 1: Overview of Computers and Programming Problem Solving & Program.
COSC 120 Computer Programming
Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 1: Overview of Computers and Programming Problem Solving &
1 Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
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 1: An Overview of Computers and Programming Languages
Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30.
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.
CIS 260 Computer Programming I in C Prof. Timothy Arndt.
COS120 Software Development Using C++ AUBG Fall semester 2010
CS 115 Chapter 1 Overview of Programming and Problem Solving.
Chapter 1 Overview of Computers and Programming. 1-1 Outline 1.1 ELECTRONIC COMPUTERS THEN AND NOW 1.2 COMPUTERS HARDWARE 1.3 COMPUTERS SOFTWARE 1.4 THE.
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.
CS 161 INTRO TO PROGRAMMING I Dr. Blaise W. Liffick Fall
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.
Introduction to Programming Dr Masitah Ghazali Programming Techniques I SCJ1013.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Introduction to Computers, Problem Solving, and Programming Chapter 1.
COS120 Software Development Using C++ AUBG Fall semester 2010 Ref book: Problem Solving, Abstraction and Design Using C++ Authors: Frank Friedman, Elliot.
Chapter 4 Programming Concepts Dept. of Computer Engineering Khon Kaen University.
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.
CISC105 General Computer Science Class 1 – 6/5/2006.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
Chapter 1 Overview of Computers and Programming J. H. Wang ( 王正豪 ), Ph. D. Assistant Professor Dept. Computer Science and Information Engineering National.
Chapter 1 Defining Information Technology. Learning Objectives The “big idea” of computing inventions Explain why it’s important to know the right word.
Introduction to Computers, Problem Solving, and Programming Chapter 1.
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1 – Computing Fundamentals. History of Electronic Computers u First computer –ABC (Atanasoff Berry Computer) at Iowa State U. –1930’s –Solved.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
Computer Architecture
Computer Basic Vocabulary
ELEMENTS OF A COMPUTER SYSTEM HARDWARE SOFTWARE PEOPLEWARE DATA.
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
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
A.Abhari CPS1251 Topic 1: Introduction to Computers Computer Hardware Computer components Connecting Computers Computer Software Operating System (OS)
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. Introduction to Computers and Computing.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Overview of Computers and Programming Problem Solving and Program.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
CHAPTER 1 OVERVIEW OF COMPUTER AND PROGRAMMING 1.1 Electronic Computer Then and Now 1.2 Computer Hardware 1.3 Computer Software 1.4 The Software Development.
Problem Solving and Program Design in C Chap. 1 Overview of Computers and Programming Chow-Sing Lin.
Professor John CarelliKutztown University Computer Science Department Computer Science I CSC 135.
Chapter 1: Introduction to Computers, Problem Solving, and Programming
BASIC PROGRAMMING C SCP1103 (02)
Chapter 1: An Overview of Computers and Programming Languages
Engineering Problem Solving With C An Object Based Approach
Chapter 1: An Overview of Computers and Programming Languages
BASIC PROGRAMMING C SCP1103 (02)
Overview of Computers and Programming Chapter 1
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
Overview of Computers and Programming
UNIV 103 CS Majors Seminar Dr. Blaise W. Liffick Fall 2017.
Computer Science I CSC 135.
Hardware & Software Programming. COMP102 Prog. Fundamentals I: Software / Slide 2 l Four components of a computer system: n CPU - central processing unit.
National Diploma in Computer Studies
CS 330 Programming Languages
ICS103 Programming in C 1: Overview of Computers And Programming
Presentation transcript:

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers, Problem Solving, and Programming Problem Solving, Abstraction, and Design using C++ 6e by Frank L. Friedman and Elliot B. Koffman

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2 Algorithms C++ Linux Codewarrior

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 3 Early Computers Late 1930’s, John Atanasoff, Clifford Berry ENIAC –1946 –University of Pennsylvania –J. Presper Eckert and John Mauchley –John von Neumann, stored-program concept

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4 Categories of Computers Supercomputers Mainframe Minicomputers Microcomputers

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-5 Figure 1.2 (a) Notebook Computer (HP Pavilion dv5©, Courtesy of Hewlett-Packard). (b) Palmtop Computer (iPhone 3G©, Courtesy of Apple, Inc.) (c) Desktop Computer (iMac©, Courtesy of Apple, Inc.)

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6 Computer Hardware CPU - central processing unit –Where decisions are made, computations are performed, and input/output requests are delegated Main Memory –Stores information being processed by the CPU Secondary Memory (Mass Storage) –Stores data and programs

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7 Computer Hardware Input devices –Allow people to supply information to computers Output devices –Allow people to receive information from computers Network connection –Modems –Ethernet interface

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-8 Figure 1.3 Components of a Computer

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 9 Memory Stores –programs operating system applications –data Types –RAM - volatile –ROM Composed of bits, which are combined into bytes

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 10 Memory Cells AddressContents H X RTV

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-11 Figure 1.5 Relationship Between a Byte and a Bit

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 12 Secondary Memory Semi permanent data-storage capability –Magnetic Hard disk Floppy disk Tape –Non-magnetic CD or DVD memory stick, flash drive Secondary memory usually has much more storage capacity than main memory

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-13 Figure 1.6 Secondary Storage Media

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 14 CPU “Brains” of the computer –Arithmetic calculations are performed using the Arithmetic/Logical Unit or ALU –Control unit decodes and executes instructions –Registers hold information and instructions for CPU to process Arithmetic operations are performed using binary number system

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-15 Figure 1.1 The Intel Atom processor chip contains the full circuitry of a central processing unit in an integrated circuit whose small size and low power requirements make it suitable for use in mobile internet devices. (Intel Corporation Pressroom Photo Archives)

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 16 Input / Output Devices Accessories that allow computer to perform specific tasks –Receiving information for processing –Return the results of processing Common input and output devices –Keyboard JoystickScanner –Printer MonitorSpeaker

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 17 Computer Networks Allows multiple computers to connect together to share resources and/or data LAN - Local area network –Organizational WAN - Wide area network –Internet Requires additional hardware –modem –network interface

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-18 Figure 1.7 Local Area Network

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-19 Figure 1.8 A Wide Area Network with Satellite Relays of Microwave Signals

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 20 World Wide Web Introduced 1989 Developed by CERN –European Laboratory for Particle Physics Web browser –GUI –Netscape –IE

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Computer Software Operating system Other system software –utilities –programming language systems Applications

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 22 Operating System E.g. Windows ®, Unix ® Controls –the interaction of system with the user –hardware interactions Part is usually stored on ROM, rest on hard drive –This arrangement requires booting the system

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 23 Some OS Responsibilities Communicating with the user; receiving user commands Managing allocation of memory, processor time, file system, and other resources Collecting input from keyboard, mouse, etc. Conveying output to screen, printer, etc. Writing data to secondary storage devices

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-24 Figure 1.9 Entering a UNIX Command for Directory Display

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-25 Figure 1.10 Accessing Secondary Storage Devices through Windows

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 26 Application Software Does the “real” work Common application software –Word processors –Desktop publishing programs –Spreadsheets –Presentation managers –Drawing programs

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 27 Programming Languages Machine Language –Most fundamental language of the computer –Unique for each processor type –Binary 0s and 1s that specify what to do

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 28 Table 1.2 A Program in Machine and Assembly Language

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 29 High - Level Languages Resemble human language –C++, C, Pascal, FORTRAN, Ada a = a + b; More compact and human understandable than machine language Must be translated into machine language

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 30 Object Oriented Programming C++ derived from C by Bjarne Stroustrup Popular because of reuse –Classes –Objects –Methods Organized in a Hierarchy –Super Classes –Sub Classes

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 31

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 32 Object Oriented Design Abstraction –Extract the relevant properties of an object while ignoring inessential details Encapsulation –Breaking down an object into parts, hiding and protecting its essential information, and supplying an interface to modify the information in a controlled and useful manner

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Processing a High-Level Language Program Set of programs used to develop software A key component is a translator –Compiler Examples –g++, Borland C++ ®, Microsoft Visual C++ ® Other programs needed –Editor –Linker –Loader

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 34 Processing a Program Editor used to enter the program –Like minimal word processor –Creates source program file Compiler translates the source program –Displays syntax errors –Creates (usually) temporary object code file Linker/Loader to combine object file with other object files and execute program –Creates final executable program

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 35 Executing a Program CPU –examines each program instruction in memory –sends out command signals required to carry out the instruction Special instructions used to –input data into memory for the program to use –output data to display or printer (or other device)

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-36 Figure 1.11 Entering, Translating, and Running a High-Level Language Program

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1-37 Figure 1.12 Flow of Information During Program Execution

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Software Development Method Problem Analysis –Identify data objects –Determine Input / Output data –Constraints on the problem Design –Decompose into smaller problems –Top-down design (divide and conquer) –Develop Algorithm (Desk check) Algorithm refinement

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 39 Software Development Method Implementation –Converting the algorithm into programming language Testing –Verify the program meets requirements –System and Unit test Maintenance –All programs undergo change over time

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Applying the Software Development Method Case Study: Converting Miles to Kilometers –Problem Your summer surveying job requires you to study some maps that give distances in kilometers and some that use miles. You and your coworkers prefer to deal in metric measurements. Write a program that performs the necessary conversion.

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 41 Case Study –Analysis The first step in solving this problem is to determine what you are asked to do. You must convert from one system of measurement to another, but are you supposed to convert from kilometers to miles, or vice versa? The problem states that you prefer to deal in metric measurements, so you must convert distance measurements in miles to kilometers.

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 42 Data Requirements Problem Input milesdistance in miles Problem Output kmsthe distance in kilometers Relevant Formula 1 mile = kilometers

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 43 Design Formulate the algorithm that solves the problem. Algorithm 1. Get the distance in miles. 2. Convert the distance to kilometers. 3. Display the distance in kilometers. Algorithm Refinement 2.1 The distance in kilometers is the distance in miles Desk check!

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 44 Listing 1.2 Miles to kilometers

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 45 Implementation #include using namespace std; int main( ) { const float KM_PER_MILE = 1.609; float miles, kms; cout << “Enter the distance in miles: “; cin >> miles; kms = KM_PER_MILE * miles; cout << “The distance in kilometers is “ << kms << endl; return 0; }

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 46 Testing Test with input data for which you can easily determine the expected results E.g. 10 miles should convert to kilometers

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Professional Ethics for Computer Programmers Privacy and Misuse of Data Computer Hacking Plagiarism and Software Piracy Misuse of a Computer Resource