From Problems to Algorithms to Programs

Slides:



Advertisements
Similar presentations
Review of Computer Hardware, Operating Systems, and Media EDUC 286: Educational Technology II: Professional Tools Fall 2009.
Advertisements

An Overview of the Computer System
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
 Computer hardware components are the physical pieces of the computer.  The major hardware components of a computer are: – The central processing.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Introduction to Computers
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.
Computer Parts There are many parts that work together to make a computer work.
Introduction to Computers Essential Understanding of Computers and Computer Operations.
CS 0008 Day 2 1. Today Hardware and Software How computers store data How a program works Operators, types, input Print function Running the debugger.
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.
Chapter Introduction to Computers and Programming 1.
Introduction to Programming Dr Masitah Ghazali Programming Techniques I SCJ1013.
Aug CMSC 104, LECT-021 Machine Architecture and Number Systems Some material in this presentation is borrowed form Adrian Ilie From The UNIVERSITY.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Topics Introduction Hardware and Software How Computers Store Data
Learning Targets Identify the external parts of the computer Identify examples of input devices Identify examples of output devices Define basic computer.
What is a Computer ? Computers are Electronic Machines that process (performs calculation and manipulation) Data under the control of Set of Instructions.
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 © 2012 Pearson Education, Inc. Chapter 1 Introduction to Computing and Programming.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
Introduction to Computers
Computer Parts. Two Basic Parts Hardware & Software.
Computer Basics 2.
Copyright © 2014 Pearson Education, Inc. Chapter 1 Introduction to Programming and Visual Basic.
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)
1 Introduction to Computers Prof. Sokol Computer and Information Science Brooklyn College.
Introduction To Computers
©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 © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Introduction To Computer Programming – 1A Computer Parts, Words, and Definition Herriman High School.
INTRODUCTION TO COMPUTERS. A computer system is an electronic device used to input data, process data, store data for later use and produce output in.
Chapter 1: Introduction to Computers and Programming
Introduction to Computers
Basic Computer Hardware and Software.
BASIC PROGRAMMING C SCP1103 (02)
An Overview of the Computer System
Information Technology
Topics Introduction Hardware and Software How Computers Store Data
Chapter 1: An Overview of Computers and Programming Languages
BASIC PROGRAMMING C SCP1103 (02)
Chapter 1: Introduction to Computers and Programming
Computer Hardware and Software
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Chapter 1: An Overview of Computers and Programming Languages
Introduction to Programming and Visual Basic
Chapter 1 Introduction to Computers and Programming
Basic Computer Hardware and Software.
Computer Basics.
Looking Inside the machine (Types of hardware, CPU, Memory)
Chapter 1: Introduction to Computers and Programming
An Overview of the Computer System
An Overview of the Computer System
Introduction to Programming and Visual Basic
Computer Science I CSC 135.
Topics Introduction Hardware and Software How Computers Store Data
Topics Introduction Hardware and Software How Computers Store Data
Chapter 3 Hardware and software 1.
Chapter 3 Hardware and software 1.
ICS103 Programming in C 1: Overview of Computers And Programming
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

From Problems to Algorithms to Programs CS 414, Spring 2017 (CRN: 55555) Betsy Coleman Lectures: Tue/Thu 12:40-2:00PM Kingsbury N328 Labs: Wed 10:10-11AM Kingsbury N218 Office: Kingsbury W243 Office Hours: Tue/Thu: 9:30-11AM Email: betsy.coleman@cs.unh.edu Web: http://cs.unh.edu/~cs414/

Computer Hardware The term hardware refers to the computer’s physical components A computer is not one device, but a system of devices Major types of components include: Central Processing Unit Main memory Secondary storage devices Input devices Output devices

The Organization of a Computer System

The CPU The central processing unit, or CPU, is the part of a computer that actually runs programs The most important component Without it, the computer could not run software Fetches instructions one by one A program is a set of instructions a computer’s CPU follows to perform a task Instructions are stored in memory as binary numbers A binary number is a sequence of 1s and 0s

Main Memory Think of main memory as the computer’s work area Holds instructions and data needed for programs that are currently running Commonly known as random-access memory, or just RAM CPU can quickly access data at any random location Used as temporary storage Contents are lost when power is turned off

Secondary Storage Most common secondary storage device is the disk drive Records data magnetically on a circular disk Other types of secondary storage devices include: External disk drives Connects to one of the computer’s communication ports USB drives Small devices that plug into a computer’s USB port Optical devices such as CDs and DVDs Data is encoded using a series of pits on the disc surface

Memory/Storage Units Binary  Decimal Conversion Units of data/memory: Bit (Binary Digit) Byte Memory word – number of bits viewed as single unit of information 32-bit word, 64-bit word

Memory/Storage Units Storage Units Byte 8 bits Kilobyte (KB) 1024 bytes 2 **10 (greater than 10 **3) Megabyte (MB) 1048576 bytes 2 **20 (greater than 10 **6) Gigabyte (GB) greater than 10 **9 Terabyte (TB) greater than 10 **12

Memory/Storage Units Floppy disk – 1.44 MB (2.0 MB) CD – 680 MB DVD (digital video drive) – 4. 7GB (4 layers) Magnetic tape drive – Sequential access Hard disk (built-in component, external) http://highscalability.com/blog/2012/9/11/how-big-is-a-petabyte-exabyte-zettabyte-or-a-yottabyte.html Directories, Files, File Structure

Input Devices Input is any data the computer collects from the outside world The device that collects and sends data to the computer is called an input device Common input devices: Keyboard Mouse Digital camera Disk and optical drives can be input devices If their data is retrieved and loaded into main memory

Output Devices Output is any data the computer sends to the outside world A sales report, list of names, graphic images, or a sound Data is sent to an output device, which formats and presents it Common output devices: Monitor Printer Disk and optical drives can be output devices If the CPU sends them data to be saved

Computer Software Computer components – “hardware” List of instructions to be executed on the hardware is called “software” (or “program”) Operating System – Collection of computer programs that control the interaction between the user and computer hardware O.S is loaded into RAM from disk at boot-time Examples: Unix, VMS, MS-DOS, OS/2 (command-line interface) Macintosh OS, Windows (graphical user interface)

Computer Software Functions of an O.S: Execute commands from the user Validate users and maintain security for access of information Processor, Memory and Resource Management Interpretation of input/output information Data retrieval and storage on to secondary storage devices

Computer Software Application Software Programs to assist computer users in performing tasks MS-WORD – Word processing application Lotus 1-2-3 – Spreadsheet application dBase, MS-Access – database management applications Several applications are “bundled” with the o.s and available after the o.s install Additional applications can be installed anytime Application Software Vs System Software

What is a Program? Computers can only follow instructions A computer program is a set of instructions on how to solve a problem or perform a task In order for a computer to compute someone’s gross pay, we must tell it to perform the steps on the following slide

Computing Gross Pay This well-defined, ordered set of steps for solving a problem is called an algorithm

States and Transitions Memory snapshots show program states Store hours worked in memory Store hourly pay rate in memory Multiply hours worked by pay rate and store amount earned in memory Program Starting State hours worked ?? hourly pay rate amount earned Snapshot after Step 3 hours worked 20 hourly pay rate ?? amount earned Snapshot after Step 6 hours worked 20 hourly pay rate 25 amount earned ?? Snapshot after Step 7 hours worked 20 hourly pay rate 25 amount earned 500

Programming Languages The steps in an algorithm must be stated in a form the computer understands The CPU processes a series of 1s and 0s called machine language instructions This is a tedious and difficult format for people Programming languages allow us to use words instead of numbers Special software called a compiler converts the programming language statements to machine language instructions

Popular Programming Languages

What is a Program Made Of? Keywords (Reserved Words) Words with special meaning that make up a high-level programming language, cannot be used for any other purpose Operators Special symbols that perform various operations on data Variables Used to store data in memory, named by the programmer Syntax Set of rules Similar to the syntax (rules) of a spoken language, such as English, but must be strictly followed If even a single syntax error appears in a program, it will not compile or execute

What is a Program Made Of? Statements Instructions made up of keywords, variables, and operators. Called source code, or simply code Functions Set of programming statements that perform a specific task Comments (Remarks) Ignored when the program runs, help human reader understand the purpose of programming statements In Python, any statement that begins with an double quote(″)

Creating Computer Programs Steps to creating a successful program Edit, Compile, Link (This depends on the language used – Python is interpreted) Editor – Word processor (Source File) Compiler – Converts high level language into machine code (Object File) Link – Resolves references made to other object files (Executable File)

Software Development Method Programming is a “problem-solving” activity Steps to programming methodology: Specify the problem requirements (state the problem) Analyze the problem Design the algorithm to solve the problem Implement the algorithm to create a program Test and verify the completed program Maintain and update the program

Software Development Method Steps 1 & 2 are very important – else you will be solving the wrong problem! Example: Problem: Calculate and display the volume of a cylinder given its base radius and height in centimeters Problem Inputs: radius of base, height (in cm) Problem Outputs: volume of cylinder (in cubic cm) Develop the relationship between inputs & outputs, in this case it’s the formula that calculates the volume

Software Development Method Step 3 – Algorithm Design Develop a list of steps called an algorithm to solve the problem Most difficult part of the problem-solving process Top-down approach – list major steps or sub problems that need to be solved, solve each sub problem, refine algorithm Typical algorithm: Get the data Perform computations Display results

Software Development Method Step 4 – Implementation Choose a language to implement the algorithm and write the program Each algorithmic step contributes to creating the program Step 5 – Testing Step 6 – Maintenance and update

Graphical User Interfaces The people who use a program are known as users The part of a program that users interact with is known as the user interface A graphical user interface or GUI (pronounced gooey) consists of one or more windows A window is a rectangular area that contains other visual elements such as text and buttons