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

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

Chapter 1 Introduction to Computers, Programs, and Java

Chapter 1 Introduction to Computers, Programs, and Java

Chapter 1 Introduction to Computers, Programs, and Java

Objectives. Chapter 1 Introduction to Computers, Programs, and Java. What is a Computer?

Chapter 1: Introduction to Computers, Programs, and Java

Chapter 1 Introduction to Computers, Programs, and Java

Chapter 1 Introduction to Computers, Programs, and Java

Chapter 1 Introduction to Computers, Programs, and Java

CMSC 1513 Lecture 1.2

Chapter 1 Introduction to Computers, Programs, and Java

Chapter 1 Introduction to Computers, Programs, and Java. What is a Computer? A Bit of History

Getting Started. Chapter 1. Java Programming FROM THE BEGINNING. Chapter 1: Getting Started

Chapter 1 Introduction to Computers, Programs, and Java

Lecture 1: Introduction to Java

Lesson 01 Introduction

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

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

Introduction to Computers, Programs, and Java. CSE 114, Computer Science 1 Stony Brook University

Introduction to Computer Programming for Non-Majors CSC 2301, Fall The Department of Computer Science

Introduction to Computer Programming for Non-Majors

CHAPTER 1 INTRODUCTION TO COMPUTERS, PROGRAMS, AND JAVA. Objectives

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

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

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

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

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

Java Language. Programs. Computer programs, known as software, are instructions to the computer. You tell a computer what to do through programs.

Programming 1 - Honors

Chapter 1: Introduction to Computers and Programming

Introduction to Java Programming

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: Why Program? Main Hardware Component Categories 8/23/2014. Main Hardware Component Categories: Why Program?

Introduction. Introduction to OOP with Java. Lecture 01: Introduction to OOP with Java - AKF Sep AbuKhleiF -

Introduction to OOP with Java. Instructor: AbuKhleif, Mohammad Noor Sep 2017

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

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

CHAPTER 1 Introduction to Computers and Java

Introduction to Java. Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved.

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

Glossary. For Introduction to Programming Using Python By Y. Daniel Liang

The Programming Process Summer 2010 Margaret Reid-Miller

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

Chapter 1 Computer and Programming. By Zerihun Alemayehu

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

Computer Fundamentals

Chapter. Focus of the Course. Object-Oriented Software Development. program design, implementation, and testing

Module 1: Introduction to Computers, Programs, and Java

Main Parts of Personal Computer

CSC 121 Computers and Scientific Thinking

Information Communications Technology (CE-ICT) 6 th Class

Lesson 1: Computer Concepts

About the Presentations

CSI31 Introduction to Computer Programming I. Dr. Sharon Persinger Fall

Week One: Introduction A SHORT INTRODUCTION TO HARDWARE, SOFTWARE, AND ALGORITHM DEVELOPMENT

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

Chapter 1 Introduction to Computers and Programming

St. Benedict s High School. Computing Science. Software Design & Development. (Part 2 Computer Architecture) National 5

Week 2: Data and Output

Basic Concepts Of Information Technology (IT)

SKILL AREA 304: Review Programming Language Concept. Computer Programming (YPG)

What is Java Platform?

Computer Components 1 CSC1103- Nouf AlJaffan Saturday, 02 February 2013

CMSC 104 -Lecture 2 John Y. Park, adapted by C Grasso

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

A+ Guide to Hardware: Managing, Maintaining, and Troubleshooting, 5e. Chapter 1 Introducing Hardware

Machine Architecture and Number Systems

Introduction to Computers and Java

9/11/08 (c) 2008 Matthew J. Rutherford Class (c) 2008 Matthew J. Rutherford Class

Introduction to Computers. Joslyn A. Smith

1. A folder inside a folder is called. a) Mini Directory b) Sub Directory c) Root Folder d) Child Folder e) None of these

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

SCSP Programming Technique C

Computer Components. Software{ User Programs. Operating System. Hardware

CIS260 Summer Exam 1 First Name Last Name: 2) is the brain of a computer. 2) A) Memory B) Hardware C) Disk D) CPU

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

Chapter Two. Hardware Basics: Inside the Box

Chapter 1. Introduction to Computers and Programming. M hiwa ahmad aziz

Chapter 1 INTRODUCTION

Chapter 1: An Overview of Computers and Logic

This is a list of vocabulary related to information and communication technology. Coloque el significado en español sobre las líneas.

Computer Principles and Components 1

Machine Architecture and Number Systems CMSC104. Von Neumann Machine. Major Computer Components. Schematic Diagram of a Computer. First Computer?

Computer Science. ESC 120 Introduction to Engineering Design

COMP Computer Basics. Yi Hong May 13, 2015

Introduction To Computer Hardware

2011 Francisco Delgadillo

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

Introduction to Computers and Java. Objectives. Outline. Harald Gall, Prof. Dr. Institut für Informatik Universität Zürich.

Introduction to Computers and Java

Python - Week 1. Mohammad Shokoohi-Yekta

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

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

Pharmacy college.. Assist.Prof. Dr. Abdullah A. Abdullah

Introduction to Computers and Java

Terminology, Types of Computers & Computer Hardware

AN INTRODUCTION TO THE COMPUTER

Computers Are Your Future

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

Transcription:

Programming: detailed instructions which tell the computer hardware what to do aka software Computer Science: the study NOT of computers, but of what can be computed what processes a computer can execute 3 techniques: design, analysis, experimentation

5 main categories of hardware: CPU, central processing unit RAM, random access memory Input devices, the means by which we interact with computers Output devices (screens, printers) Storage devices (hard drive, flash drives)

A computer consists of a CPU, memory, hard disk, floppy disk, monitor, printer, and communication devices. Memory Disk, CD, and Tape Storage Input Keyboard, Mouse CPU Modem, and NIC Communication Output Monitor, Printer 3

The central processing unit (CPU) is the brain of a computer. It retrieves instructions from memory and executes them. The CPU speed is measured in megahertz (MHz), with 1 megahertz equaling 1 million pulses per second. The speed of the CPU has been improved continuously. If you buy a PC now, you can get an Intel Pentium 4 Processor at 3 gigahertz (1 gigahertz is 1000 megahertz). Memory Disk, CD, and Tape Storage Input Keyboard, Mouse CPU Modem, and NIC Communication Output Monitor, Printer 5

Memory is to store data and program instructions for CPU to execute. A memory unit is an ordered sequence of bytes, each holds eight bits. A program and its data must be brought to memory before they can be executed. A memory byte is never empty, but its initial content may be meaningless to your program. The current content of a memory byte is lost whenever new information is placed in it. Memory Disk, CD, and Tape Storage Input Keyboard, Mouse CPU Modem, and NIC Communication Output Monitor, Printer 6

Data of various kinds, such as numbers, characters, and strings, are encoded as a series of bits (zeros and ones). Computers use zeros and ones because digital devices have two stable states, which are referred to as zero and one by convention. The programmers need not to be concerned about the encoding and decoding of data, which is performed automatically by the system based on the encoding scheme. The encoding scheme varies. For example, character J is represented by 01001010 in one byte. A small number such as three can be stored in a single byte. If computer needs to store a large number that cannot fit into a single byte, it uses a number of adjacent bytes. No two data can share or split a same byte. A byte is the minimum storage unit. Memory address... 2000 2001 2002 2003 2004 Memory content... 01001010 Encoding for character J 01100001 Encoding for character a 01110110 Encoding for character v 01100001 Encoding for character a 00000011 Encoding for number 3 7

Memory is volatile, because information is lost when the power is off. Programs and data are permanently stored on storage devices and are moved to memory when the computer actually uses them. There are three main types of storage devices:disk drives (hard disks and floppy disks), CD drives (CD-R and CD-RW), and Tape drives. Memory Disk, CD, and Tape Storage Input Keyboard, Mouse CPU Modem, and NIC Communication Output Monitor, Printer 8

The monitor displays information (text and graphics). The resolution and dot pitch determine the quality of the display. Memory Disk, CD, and Tape Storage Input Keyboard, Mouse CPU Modem, and NIC Communication Output Monitor, Printer 9

resolution dot pitch The resolution specifies the number of pixels per square inch. Pixels (short for picture elements ) are tiny dots that form an image on the screen. The resolution can be set manually. The higher the resolution, the sharper and clearer the image is. However, the image may be very small if you set high resolution on a small screen monitor. PC monitors are usually 15-inch, 17-inch, 19-inch, or 21-inch. For a 15- inch monitor, a comfortable resolution setting would be 640 480 (307,200 pixels). The dot pitch is the amount of space between pixels. The smaller the dot pitch, the better the display. 10

A regular modem uses a phone line and can transfer data in a speed up to 56,000 bps (bits per second). A DSL (digital subscriber line) also uses a phone line and can transfer data in a speed 20 times faster than a regular modem. A cable modem uses the TV cable line maintained by the cable company. A cable modem is as fast as a DSL. Network interface card (NIC) is a device to connect a computer to a local area network (LAN). The LAN is commonly used in business, universities, and government organizations. A typical type of NIC, called 10BaseT, can transfer data at 10 mbps (million bits per second). Memory Disk, CD, and Tape Storage Input Keyboard, Mouse CPU Modem, and NIC Communication Output Monitor, Printer 11

Computer programs, known as software, are instructions to the computer. You tell a computer what to do through programs. Without programs, a computer is an empty machine. Computers do not understand human languages, so you need to use computer languages to communicate with them. Programs are written using programming languages. 12

Rules and conventions by which we write algorithms (step-by-step instructions) Syntax: the rules for the form of the language Semantics: the rules for the meaning of a language High-level languages: C++, C, Perl, Java, BASIC, Python

Machine Language Assembly Language High-Level Language Machine language is a set of primitive instructions built into every computer. The instructions are in the form of binary code, so you have to enter binary codes for various instructions. Program with native machine language is a tedious process. Moreover the programs are highly difficult to read and modify. For example, to add two numbers, you might write the an instruction in binary like this: 1101101010011010 14

Machine Language Assembly Language High-Level Language Assembly languages were developed to make programming easy. Since the computer cannot understand assembly language, however, a program called assembler is used to convert assembly language programs into machine code. For example, to add two numbers, you might write an instruction in assembly code like this: ADDF3 R1, R2, R3 Assembly Source File Machine Code File ADDF3 R1, R2, R3 Assembler 1101101010011010 16

Machine Language Assembly Language High-Level Language The high-level languages are English-like and easy to learn and program. For example, the following is a high-level language statement that computes the area of a circle with radius 5: area = 5 * 5 * 3.1415; 17

Java COBOL (COmmon Business Oriented Language) FORTRAN (FORmula TRANslation) BASIC (Beginner All-purpose Symbolic Instructional Code) Pascal (named for Blaise Pascal) Ada (named for Ada Lovelace) C (whose developer designed B first) Visual Basic (Basic-like visual language developed by Microsoft) Delphi (Pascal-like visual language developed by Borland) C++ (an object-oriented language, based on C) 18

A program written in a high-level language is called a source program. Since a computer cannot understand a source program. Program called a compiler is used to translate the source program into a machine language program called an object program. The object program is often then linked with other supporting library code before the object can be executed on the machine. Source File Compiler Object File Linker Excutable File 19

You can port a source program to any machine with appropriate compilers. The source program must be recompiled, however, because the object program can only run on a specific machine. Nowadays computers are networked to work together. Java was designed to run object programs on any platform. With Java, you write the program once, and compile the source program into a special type of object code, known as bytecode. The bytecode can then run on any computer with a Java Virtual Machine, as shown in Figure 1.5. Java Virtual Machine is a software that interprets Java bytecode. Java Bytecode Java Virtual Machine Any Computer 20

The operating system (OS) is a program that manages and controls a computer s activities. You are probably using Windows 98, NT, 2000, XP, or ME. Windows is currently the most popular PC operating system. Application programs such as an Internet browser and a word processor cannot run without an operating system. User Application Programs Operating System Hardware 21

Compiling: The source code (the original program, such as one you might write) is processed by the compiler, a program with checks for errors, adds pre-written programs, and translates the source code into machine code.

An interpreter does not create a permanent machine code program in order to run source code on a computer. The source code is translated instruction by instruction each time the interpreted program is run. Interpreted programming languages are slower than compiled programs, but they are more flexible because you can change the interpreted program in the source code. With a compiler, you have to re-compile each time a change is made in the source code.

An interpreted language Python was created by Guido van Rossum (Netherlands) in the late 1980s, based on the ABC programming language. First publication: 1991 Version 1.0: 1994 Python uses indentation (not curly braces) to mark statement blocs also called the offside rule

Open the Terminal application Type python and hit <Enter>. This starts the Python Interpreter. To write a full program, enter your source code in TextEdit. Save the file as filename.py. To load programs in the Interpreter, type import filename. Any name from inside the file is available as filename.functionname().

>>> print Hello, World Then press the Enter key Defining a function: >>> def talking(): print The computer says: print Bug off, bozo! Then invoke the function: >>>talking()

# File: chaos.py # A simple program illustrating chaotic behavior. def main(): print "This program illustrates a chaotic function" x = input("enter a number between 0 and 1: ") for i in range(10): x = 3.9 * x * (1 - x) print x main()