Computer Hardware and Software Introduction. Mr. Smith AP Computer Science A

Similar documents
COMPUTER MERIT BADGE TROOP 301 HUTCHINSON

Computer Basics. Computer Technology

Test Bank for Prelude to Programming Chapter 0

TUTORIAL Describe the circumstances that would prompt you to use a microprocessorbased design solution instead of a hard-wired IC logic design.

ICOM 4015: Advanced Programming

COMP163. Introduction to Computer Programming. Introduction and Overview of the Hardware

2011 Francisco Delgadillo

Week 2: Data and Output

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

Components of a personal computer

Chapter 1. Computer System Organization

Elementary Computing CSC M. Cheng, Computer Science 1

Introduction to Software Development (ISD) David Weston and Igor Razgon

CHAPTER 1 Introduction to Computers and Java

2/9/2012. Chapter One: Introduction. Chapter Goals

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

Microprocessors I MICROCOMPUTERS AND MICROPROCESSORS

The Programming Process Summer 2010 Margaret Reid-Miller

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

Computers Are Your Future

Introduction to Computers and Java

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 INTRODUCTION. Final Draft Oct. 15, Slides by Donald W. Smith TechNeTrain.com. Copyright 2013 by John Wiley & Sons. All rights reserved.

Chapter Goals. Contents. 1.1 Computer Programs

HARDWARE. There are a number of factors that effect the speed of the processor. Explain how these factors affect the speed of the computer s CPU.

Chapter 1 - Introduction. Copyright 2014 by John Wiley & Sons. All rights reserved. 1

Name: Date: Hour: The abacus (still in use today) is about 5,000 years old. Not a computer.

Three-box Model: These three boxes need interconnecting (usually done by wiring known as a bus. 1. Processor CPU e.g. Pentium 4 2.

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

COMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2016

Chapter 1 Introduction to Computers, Programs, and Java

Parts of the Computer System. Parts of the Computer System. Parts of the Computer System. Essential Computer Hardware. Information Processing Cycle

3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS)

CS 177 Recitation. Week 1 Intro to Java

Computer Hardware. Java Software Solutions Lewis & Loftus. Key Hardware Components 12/17/2013

Parts of Computer hardware Software

Welcome to COS151! 1.1

Introduction to Computers and Java

Chapter 2: Computers: The Machines Behind Computing.

Chapter Goals. Chapter One: Introduction. Prerequisites. What Is Programming?

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

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

HANDOUT: COMPUTER PARTS

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

ETGG1801 Game Programming Foundations I Andrew Holbrook Fall Lecture 0 - Introduction to Computers 1

Notes - Computer Hardware Basics

Chapter 1 Introduction to Computers and Programming

CHAPTER 1 TYPES & COMPONENTS OF COMPUTER SYSTEM

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

Babbage s computer 1830s Boolean logic 1850s. Hollerith s electric tabulator Analog computer 1927 EDVAC 1946 ENIAC

Computers in Engineering COMP 208. A Brief History. Mechanical Calculators. A Historic Perspective Michael A. Hawker

Computers in Engineering COMP 208

Chapter 1: Introduction to Computers and Programming

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

Computer Hardware. In this lesson we will learn about Computer Hardware, so that we have a better understanding of what a computer is.

Computer Fundamentals

Java and Software Design

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

Chapter 1 Computer and Programming. By Zerihun Alemayehu

Introduction To Computer Hardware. Hafijur Rahman

From Algorithms to Architecture....a lightning introduction to computer architecture

Chapter Two. Hardware Basics: Inside the Box

Chapter 1. The Big Picture

COMPUTER ORGANIZATION & SKILLS

Computers Are Your Future

QUESTIONS ABOUT COMPUTERS

Homeschool Enrichment. The System Unit: Processing & Memory

Which statement regarding computer programs is correct? Which statement best describes a computer program?

Chapter One. Introduction to Computer System

Introduction to Computer Systems and Operating Systems

Introduction to Computers and Java

Introduction to Java Programming

Overview of a computer

SSRVM Content Creation Template

Introduction To Computers. About the Course

ICDL-IT. ICDL The ICDL L4 IT. ICDL-IT ICDL

15/09/15. Introduction to Computers & The Internet. Contents. Computer hardware and software. Input and output devices CPU. Memory.

1: History, Generation & Classification. Shobhanjana Kalita, Dept. of CSE, Tezpur University

COMP2121: Microprocessors and Interfacing. Introduction to Microprocessors

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

Lecture 2 Microcomputer Organization: Fig.1.1 Basic Components of Microcomputer

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

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

CSE 1223: Introduction to Computer Programming in Java Chapter 1 Computer Basics

5. a computer which CPU speed around 100 million instruction per second and with the word length of around 64 bits is known as

Information Communications Technology (CE-ICT) 6 th Class

INTRODUCTION TO COMPUTERS

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

Computer Organization

Hardware. Hardware is the physical components that you knock on, that you can touch. (Monitor, processor chip, CD-ROM drive set.)

SYSTEM BUS AND MOCROPROCESSORS HISTORY

Chapter Goals. Contents INTRODUCTION

Welcome to COSC Introduction to Computer Science

About the Presentations

Chapter 2: Programming Concepts

Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Computing Layers

Chapter 1 INTRODUCTION

Full file at

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

Transcription:

Computer Hardware and Software Introduction Mr. Smith AP Computer Science A

History of Computers Abacus 1100 BC Slide rule - 1617 Mechanical calculator - 1642 Automatic loom (punched cards) - 1804 Babbage s computer 1830s Boolean logic 1850s Hollerith s electric tabulator - 1880 Analog computer 1927 EDVAC 1946 ENIAC - 1947 Transistor - 1947 Integrated circuit late 1950s UNIVAC 1951 Microprocessor 1971 Altair 8880 1975 Apple II 1977 IBM PC 1981 World Wide Web 1990s

What is Programming? A computer must be programmed to perform a task A computer is a machine that: Stores data (numbers, words, and pictures) Interacts with devices (monitor, sound system, printer) Executes programs Typical operations are: Put a red dot onto this screen position Send letter Z to the printer Get a number from a specific location in memory Multiply two numbers If this value > 10, execute a certain instruction A computer program tells the computer, in much detail, the sequence of steps to complete a task.

Anatomy of a Computer Central Processing Unit (CPU): It is the Brain of your computer. It consists of a single chip (integrated circuit) or a small number of chips A computer chip has plastic or metal housing, metal connectors, and inside wiring made mainly of silicon A chip contains millions of transistors (the elements that enable electrical signals to control other electrical signals) The main tasks of the CPU are: To locate and execute the program instructions To carry out arithmetic operations To fetch data from storage and input/output devices To send data back to devices

Anatomy of a Computer Storage: Primary known as RAM or Memory Fast, but relatively expensive Made from memory chips Loses its data when power is turned off Secondary usually a hard disk Less expensive storage Keeps data when electricity is turned off CD-ROM Flash drive DVD

Anatomy of a Computer Other things to know about your computer: I/O Devices Enables you to interact with a computer Keyboard, mouse, monitors, printers Motherboard Contains CPU, RAM, and connectors to peripheral devices Bus Set of electrical lines that connect the CPU, RAM, and connectors Network Allows a computer to communicate with other computers or devices not directly connected to this computer

Compiling a Simple Program Printing to the console: public class TrivialProgram { public static void main (String[] args) { System.out.print( This prints a line. ); System.out.println( This stays on the same line. ); System.out.println( This prints on a new line. ); Object Method Parameters (out is a static PrintStream object in System class) This program will print the following to the console: This prints a line. This stays on the same line. This prints on a new line. Whenever you call this method in Java, you need to specify these 3 items

System.out.println() public class System { public static PrintStream out; public class PrintStream { public void println(string s) {. public void print(string s) {.

JavaConceptsCh1 Homework This assignment will give you practice printing to the console. You need to use System.out.print() and System.out.println() methods. We are also using static methods in this assignment. In eclipse, create a new project named JavaConcepts. On the first screen, make sure that all the radio buttons are active on the top options. This project has no additional jar files you need to use. Create a new package named javaconcepts in this project. Download the JavaConceptsCh1.java and JavaConceptsCh1Tester.java classes and put them in this new package. Pay careful attention to the comments for instructions and explanations. Ex. R1.2, R1.4, R1.7, R1.12 (page 28) create answerstoreviewexercises() method to print your answers to the console. Ex. P1.2 (page 29) create faceprinter() method to print a face using text characters. Be creative. Ex. P1.3 (page 29) create tictactoeboard() method must use looping to get full credit; this is an example of a fence post problem.

Java Comments Using comments in your Java programs: Single line comments use // Anything following // on the same line is a comment Robot.move(); // This makes the robot move Multi-line comments use /* and */ Anything after the /* and before the */ is a comment Comments can span lines /* The following while loop will calculate the interest payment for my house */ Javadoc comments use /** and */ Anything after the /** and before the */ is a comment Comments can span lines /** This program is used to create a robot that can go through a maze */

Java Errors Errors encountered within Java programs: Compile-time errors Violation of the rules of the programming language Compiler detects syntax/lexical errors Examples: Missing semi-colons, missing brackets, and missing parentheses are examples of syntax errors. Misspelling a method name is an example of a lexical error caught at compile-time. Logic errors Causes the program to take an action that the programmer did not intend. Program runs without an error message.

Translating Programs to Machine Code A Compiler translates high level language (Java program code) into machine code (also known as Java bytecode) An Interpreter is similar to a compiler but translates and executes a single statement at a time. An Editor is used to create or change a Java program The Editor and Compiler may be part of the same software known as an Integrated Development Environment (IDE), such as eclipse. An IDE can also contain a Debugger. A Java Virtual Machine (JVM) is written for every major operating system. It is like a simulated CPU that runs inside an operating system. The JVM reads the bytecode and executes the program. The Operating system manages the computer resources

Java Compilation Process How compilation works: You type a Java source program into an IDE such as eclipse. The source code has the extension.java The Compiler reads the source program and if it finds errors, it displays errors in the editor s console. After errors are corrected, the compiler is able to translate your source program into a class file (Java bytecode). This file has the extension.class The Java Virtual Machine then does the following: Loads the instructions for the program (.class file) Starts the program Loads any other necessary library (jar) files JVM is the reason that we can run the program on different operating systems.

Java Compilation Process This is the result of saving your program in eclipse with no errors Editor Compiler Class JVM files An Editor is used to create or modify source code Source file (.java file ) Eclipse is an IDE which is both an editor and compiler A Compiler converts the source file into a Bytecode file Bytecode file (.class file ) Library files Jar files and System library files (.jar file ) Running program This is the result of running your program in eclipse

Compiling a Simple Program Displaying a message in a dialog box: import javax.swing.joptionpane; Package Class public class DialogBox { Parameters public static void main (String[] args) Parent Message { Class JOptionPane.showMessageDialog(null, "Hello, World!"); System.exit(0); This method brings up a confirmation dialog box that displays a message and waits for user to confirm it. Exits the program. A nonzero status indicates abnormal termination This program will display a message box: Hello, World! Press OK to acknowledge the message Check out Appendix C for list of Java Libraries

Compiling a Simple Program Using a dialog box to prompt for information: public class DialogViewer { public static void main (String[] args) { User input is assigned to this variable String name = JOptionPane.showInputDialog("What is your name?"); System.out.print(name); System.exit(0); will display a dialog box that asks: What is your name? You would then enter your name and press Ok. Parameter Prompt This method brings up an input dialog box which displays a prompt and waits for user to enter data into it Whatever you entered would be assigned to the name variable

PrintAddress class PrintAddress class: Prompt the user to enter the following information in six separate dialog boxes: 1) first name 2) last name 3) street address 4) city 5) state 6) zip Then print this information to the console in the following format: John Doe 110 Oak Street Winston-Salem, NC 27101 At the end, display the following dialog message: Thank you for entering your name and address