Problem Solving and Program Design - Chapter 1. Cory L. Strope

Similar documents
CSCE150A. Administrivia. Overview. Hardware. Software. Example. Program. Pseudocode. Flowchart. Control Structures. Hello World Program CSCE150A

Computer Science & Engineering 150A Problem Solving Using Computers

Computer is an electronic machine that can receive, store, transform and output data of all kinds (image, text, numeric, graphics and sound).

Chapter 1: An Overview of Computers and Programming Languages. Objectives. Objectives (cont d.) Introduction

Programming 1. Lecture 1 COP 3014 Fall August 28, 2017

Programming 1 - Honors

Chapter 1: Why Program? Main Hardware Component Categories 8/23/2014. Main Hardware Component Categories: Why Program?

Chapter 1: Introduction to Computers and Programming

Week 1 Introduction to Computer and Algorithm (Part1) UniMAP Sem II 11/12 DKT121: Basic Computer Programming 1

BITG 1113: Introduction To Computers And Programming Language LECTURE 1 LECTURE 1 1

Fundamentals of Programming Session 1

Chapter 1: Why Program? Computers and Programming. Why Program?

Introduction to Computers. Joslyn A. Smith

Chapter 1: Introduction to Computers and Java

8/23/2014. Chapter Topics. Introduction. Java History. Why Program? Java Applications and Applets. Chapter 1: Introduction to Computers and Java

Chapter 1 Introduction to Computers and Programming

CHAPTER 1 Introduction to Computers and Java

Introduction to Java Programming

Java and Software Design

C++ Programming Language Lecture 1 Introduction

Week 0: Intro to Computers and Programming. 1.1 Why Program? 1.2 Computer Systems: Hardware and Software. Hardware Components

Fundamentals of Programming Session 1

Computer Fundamentals

1) Which of the following is an example of a programming language? 1) A) Microsoft Word B) English C) HTML D) Java

! Learn how to think like a computer scientist. ! Learn problem solving. ! Read and write code. ! Understand object oriented programming

0 Introduction: Computer systems and program development

Chapter 1 Computer and Programming. By Zerihun Alemayehu

EKT 120/4 Computer Programming KOLEJ UNIVERSITI KEJURUTERAAN UTARA MALAYSIA

Outline. Introduction to Programming (in C++) Introduction. First program in C++ Programming examples

Zimmer CSCI /24/18. CHAPTER 1 Overview. COMPUTER Programmable devices that can store, retrieve, and process data.

Syllabus for Computer Science General Part I

Elements of Computers and Programming Dr. William C. Bulko. What is a Computer?

W1005 Intro to CS and Programming in MATLAB. Brief History of Compu?ng. Fall 2014 Instructor: Ilia Vovsha. hip://

A Review of Chapter 5 and. CSc 2010 Spring 2012 Instructor: Qian Hu

ENT 189: COMPUTER PROGRAMMING. H/P: Home page:

Question Bank. Fundamentals Of Computer FYBCA (SEM - I)

Computer Architecture 2/26/01 Lecture #

CSc 10200! Introduction to Computing. Lecture 1 Edgardo Molina Fall 2013 City College of New York

Fundamentals of Programming (Python) Basic Concepts. Ali Taheri Sharif University of Technology Spring 2018

Fundamentals of Programming. Lecture 1: Introduction to C Programming

SCSP Programming Technique C

Topics. Hardware and Software. Introduction. Main Memory. The CPU 9/21/2014. Introduction to Computers and Programming

An Introduc+on to Computers and Java CSC 121 Spring 2017 Howard Rosenthal

Chapter 1 Introduction to Computers and C++ Programming

The Programming Process Summer 2010 Margaret Reid-Miller

8/16/12. Computer Organization. Architecture. Computer Organization. Computer Basics

CSC180: Lecture 2. Wael Aboulsaadat.

CHAPTER 1: INTRODUCTION TO COMPUTERS AND PROGRAMMING. 1 Muhalim Mohamed Amin Faculty of

Lecture -1- By lec. (Eng.) Hind Basil University of technology Department of Materials Engineering

ET156 Introduction to C Programming

SME1013 PROGRAMMING FOR ENGINEERS

Administration Computers Software Algorithms Programming Languages

Programming: detailed instructions which tell the computer hardware what to do aka software Computer Science: the study NOT of computers, but of what

Computer Fundamentals

COURSE OUTLINE & WEEK WISE BREAKAGE

CS 105 Review Questions #3

Programming 1. Lecture 1 COP 3014 Fall August 28, 2018

Lecture 1: CS2400 Introduction to Computer Science

Introduction to Basis and Practice in Programming

Computer Software: Introduction

Computer Principles and Components 1

ST. MARY S COLLEGE FORM 4

C H A P T E R 1. Introduction to Computers and Programming

CS150 Introduction to Computer Science 1. What is CS150? Who Are We? CS150 is a programming course You will learn

Python - Week 1. Mohammad Shokoohi-Yekta

From High Level to Machine Code. Compilation Overview. Computer Programs

A Quick Review of Chapter 1

Low-Level Languages. Computer Programs and Programming Languages

Lecture 1: Preliminaries

Computing and compilers

An Introduction to Computers and Java CSC 121 Spring 2015 Howard Rosenthal

Week 2: Data and Output

Week 1 Introduction to Programming

Computer Programming-1 CSC 111. Chapter 1 : Introduction

CS2303 C14 Systems Programming Concepts. Bob Kinicki

Basic Computer Programming for ISNE. Santi Phithakkitnukoon ผศ.ดร.ส นต พ ท กษ ก จน ก ร

Chapter 1 INTRODUCTION

Computer Basics 1/6/16. Computer Organization. Computer systems consist of hardware and software.

Introduction. Arizona State University 1

Computer ANAMIKA ACADEMY. Mo Which function has the ability to move from one web page to another Hyper link

CS 1713 Introduction to Computer Programming II Ch 0 Overview - Problem solving

Fundamentals of Programming (C)

Computers in Engineering COMP 208. Computer Structure. Computer Architecture. Computer Structure Michael A. Hawker

COMPUTER BASICS LECTURER: ATHENA TOUMBOURI

What is the typical configuration of a computer sold today? 1-1

CSI32 Object-Oriented Programming

Chapter 2: Computers: The Machines Behind Computing.

Vocabulary Platform Computing\ First grade Theoretical number of hours=30 Practical number of hours =60

Chapter 1: An Overview of Computers and Logic

A1-R3: IT TOOLS & APPLICATIONS

Copyright 2005 Department of Computer & Information Science

1.The First Instrument known in the history of computers was. a) Pascal s adding machine b) Napier s bones c) Abacus d) Analytical Engine

The Computer Revolution. Chapter 1. The Processor Market. Classes of Computers. Morgan Kaufmann Publishers August 28, 2013

Computer Technology Flash Card 2

Computer Basics 1/24/13. Computer Organization. Computer systems consist of hardware and software.

Engineering Computing M1H Together Towards A Green Environment

COP 1170 Introduction to Computer Programming using Visual Basic

Information Communications Technology (CE-ICT) 6 th Class

Class List. Java Must Have. Class Goals. Class Goals. Schedule

An Overview of the Computer System. Kafui A. Prebbie 24

Transcription:

Problem Solving and Program Design - Chapter 1 Cory L. Strope

Overview of Computers and Programming Computer Hardware Computer Software Software Development (Problem Solving) Pseudocode Flowchart

Intro. to Computers Computers receive, store, process, and output information. Computer can deal with numbers, text, images, graphics, and sound, to name a few. Computers are useless without programming. Programming Languages allow us to write programs and thus communicate with computers. It takes our code and converts it to binary (0 and 1) so the computer can understand it.

Different Types of Computers Personal Computer - used by everyday people, least powerful of the three and typically used by just one person at a time. Mainframes - used for real-time systems, ATMs, and such, very powerful and reliable computers. Supercomputers - used by research laboratories for computationally intensive applications such as weather forecasting, the largest capacity and fastest mainframes.

Hardware vs. Software Hardware is the equipment used to perform the necessary computations. i.e. CPU, monitor, keyboard, mouse, printer, etc. Software is the programs that enable us to solve problems with a computers by providing it with a list of instructions to follow i.e. Word, Internet Explorer, VI, etc.

Computer Hardware Main Memory RAM - Random Access Memory - Memory that can be accessed in any order. ROM - Read Only Memory - Memory that cannot be written to Secondary Memory - Hard disks, floppy disks, zip disks, CDs, & DVDs. Central Processing Unit (CPU) - Coordinating all computer operations and perform arithmetic and logical operations. Input/Output Devices - Monitor, printer, keyboard, & mouse. Computer Networks (not hardware, but configuration of the hardware) - WAN, LAN, MAN, Wireless-LAN.

Memory Memory is an essential component in any computer. Anatomy of Memory Memory Cell - the storage locations Address - the location of the memory cell relative to other memory cells Content - what is stored in the memory cell All programs run in memory Every memory cell has content, whether we know it or not. So always initialize variables bit - deriving from binary digit is either a 0 or 1. byte - a memory cell is actually a grouping of smaller units called bytes. A byte is made up of 8 bits. This is about the amount of storage required to store a single character, such as the letter H.

Computer Software Operating System - controls the interaction between machine and user. Communicate with computer user. Manage memory. Collect input/display output. Read/Write data. Application Software - developed to assist a computer use in accomplishing specific tasks (i.e. Word, Excel, & Explorer).

Computer Languages Machine Language - A collection of binary numbers Machine language is not standardized, and will vary between families of processors, such as Intel (x86) and Macintosh. Assembly Language - mnemonic codes rather than binary. Low-level language - A language that is close to the hardware. Same structure and set of commands as the hardware, but uses names instead of numbers. High-level Languages - combine algebraic expressions and symbols from English High-level language (HLL) - Closer to human language, easier to read, write, and maintain. Must be translated to Machine language Independent from the hardware (Fortran, Cobol, Lisp, C, Prolog, Pascal, C#, & Java).

Computer Languages Image from http://www.webopedia.com/term/h/high level language.html

Examples of Different Levels of Computer Languages

Compiling Code Compiling is the process of taking your source code and turning it into executable code. Source file - A file containing the program code. A compiler turns the source file into an object file. Object file - a file containing machine language instructions. A Linker turns the object file into an executable. Integrated Development Environment (IDE) - a program that combines simple word processing with a compiler, linker, and loader.

Compiler Overview - Page 18

Software Development Method Specify the problem requirements. Analyze the problem. Design the algorithm to solve the problem. Implement the algorithm. Test and verify the completed program. Maintain and update the program.

Steps Defined Problem - specifying the problem requirements forces you better understand the problem. Analysis - analyzing the problem involves identifying the problems inputs, outputs, and addition requirements. Design - designing the algorithm to solve the problem requires you to develop a list of steps that solve the problem and verify the steps. Implementation - implementing is writing the algorithm as a program. Testing - testing accuracy of the program. Maintenance - maintaining involves finding previously undetected errors and update the program to code. Failure is part of the process.

Example: Converting Miles to Kilometers Problem - you summer job wants you to convert a list of miles to kilometers Analysis Input: Number of miles, Output: Number of kilometers, Relevant info: 1 mile = 1.609 kilometers Design: 1. Get distance in miles 2. Convert to kilometers 3. Display kilometers

Implementation #include <stdio.h> int main(void) { double miles, kilometers; printf("how many miles do you have?"); scanf("%lf",&miles); kilometers = miles * 1.609; printf("you have %f kilometers\n",kilometers); } return 0;

Testing We need to test the previous program to make sure it works. To test we run our program and enter different values and make sure the output is correct.

Pseudocode Pseudocode - A combination of English phrases and C constructs to describe algorithm steps. Flowchart - A diagram that shows the step-by-step execution of a control structure. Less commonly used than pseudocode, but gives you a visual feel for the flow of the program. Algorithm - A list of steps for solving a problem.

Pseudocode Pseudocode is simply an outline of a program. Cannot be compiled nor executed, There are no formatting or syntax rules. The benefit of pseudocode is that it enables the programmer to concentrate on the algorithms without worrying about the syntactic details of a particular programming language. In fact, You can write pseudocode without even knowing what programming language you will use for the final implementation. Program M2KM: 1. Input Miles 2. kilometers = 1.609 miles 3. Output Miles

Seven Structures Control Structure: A method for controlling the order in which instructions execute. In C, there are 7 control structures 1. Sequential 2. If Then 3. If Then Else 4. Switch 5. For Do 6. While Do 7. Do While

Sequential Use sequential structure whenever program statements follow one after the other with no decisions and no repetitions. Processing flow is always downward from top to bottom in sequential structures.

If Then Use the If Then structure when there is a single process to do or not do. Processing flow is down either the left side or the right side.

If Then Else Use If Then Else when one of two processes must be chosen. Processing flow is down either the left side or the right side.

Switch Whenever there are multiple potential options depending on a single values, use the switch statement. Example: Multiple If-Then-Else statements.

For Do Use For Do when you need to repeat an action multiple times, and you know how many times you will repeat it.

While Do Use While Do when the number of loops is unknown and process might not be executed at all (indeterminate pre-test).

Do While Use Do While when number of loops is unknown and process must be done at least once (indeterminate post-test).

Which Structure to Use One Step After Another No Re Use Steps (loop) No Yes SEQUENTIAL Yes IF THEN Yes Do or Do Not? FOR DO Yes # of loops known? IF THEN ELSE Yes No One of Two? No DO WHILE Yes Do at least once? SWITCH Yes No One of Many? No WHILE DO Yes Might be skipped

Flowchart Action to perform Start or Terminal Decision to be made Document Display information On page connector Manual input Off page connector

Example of Flowchart Start Get Grades Compute Grade Display Grade End

Example of Pseudocode Problem - How do I compute my grade for this class? Specify the problem - get the grades for the class and compute the final grade. Analyze the problem - we need to input the grades, output the grade, and percentage for each part of the class. Design - 1. Get the grades homeworks, quizzes, exams, lab, and CodeLab 2. Grade = homework *.20 + quizzes *.10 + CodeLab *.10 + exam1 *.25 + exam2 *.25 + lab *.10 3. Output the Grade Implement - We can implement after we learn how to program.

Questions over chapter 1?