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

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

 2005 Pearson Education, Inc. All rights reserved Introduction.
Chapter 1 These slides for CSE 110 Sections are based in part on the textbook-authors’ slides, which are copyright by the authors. The authors state that.
Using Computers CS French Chapter 1.
COSC 120 Computer Programming
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
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,
UNIX chapter 03 Getting Started Mr. Mohammad Smirat.
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.
Chapter 1 - Introduction. Ch 1Goals To understand the activity of programming To learn about the architecture of computers To learn about machine code.
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
CS102 Introduction to Computer Programming
Computer Programming-1 CSC 111 Chapter 1 : Introduction.
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.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Topics Introduction Hardware and Software How Computers Store Data
Week 1 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
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.
1 Chapter 2 First Java Programs Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 1 Introduction to Computers and Programming.
What is a Computer? An, electrical machine, that can be programmed to accept data (input), process it into useful information (output) and store it away.
Big Java by Cay Horstmann Copyright © 2008 by John Wiley & Sons. All rights reserved. Chapter One: Introduction.
Week 1 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
Computer Hardware and Software Introduction Mr. Smith AP Computer Science A.
Big Java by Cay Horstmann Copyright © 2009 by John Wiley & Sons. All rights reserved. Chapter 1 – Introduction.
CHAPTER 1 INTRODUCTION. CHAPTER GOALS To understand the activity of programming To understand the activity of programming To learn about the architecture.
Fall 2006Slides adapted from Java Concepts companion slides1 Introduction Advanced Programming ICOM 4015 Lecture 1 Reading: Java Concepts Chapter 1.
Lesson 3 — How a Computer Processes Data Unit 1 — Computer Basics.
WHAT IS HARDWARE? Hardware refers to the set of components that make up the internal part of a computer. In case of the personal computers, it doesn’t.
Computer Basic Vocabulary
ELEMENTS OF A COMPUTER SYSTEM HARDWARE SOFTWARE PEOPLEWARE DATA.
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.
Chapter 1 Introduction. Chapter Goals To understand the activity of programming To learn about the architecture of computers To learn about machine code.
Chapter 1 - Introduction. Announcements Info Sheet Web Site: Lab Hours NotecardsPictures.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
1. COMPUTERS AND PROGRAMS Rocky K. C. Chang September 6, 2015 (Adapted from John Zelle’s slides)
CS 177 Recitation Week 1 – Intro to Java. Questions?
CHAPTER 1 COMPUTER SCIENCE II. HISTORY OF COMPUTERS (1.1) Eniac- one of the worlds first computers Used more electricity than an entire city block of.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.
Computer Basics Just How Does a Computer Work?
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Hardware and Software By: Kyle Face. Hardware! Main computer hardware components Hardware refers to the physical components of a computer (What you can.
PCs ENVIRONMENT and PERIPHERALS Lecture 3. operating system and other system software that control the usage of the computer equipment application programs.
Chapter 1: Introduction to Computers and Programming
Chapter 1 Introduction 2nd Semester H
Computer Science II Chapter 1.
Chapter 1: An Overview of Computers and Programming Languages
Topics Introduction Hardware and Software How Computers Store Data
Lecture 1: Introduction to JAVA
Java programming lecture one
Introduction to Computing Lecture # 1
Chapter 1: Introduction to Computers and Programming
CS190/295 Programming in Python for Life Sciences: Lecture 1
Topics Introduction Hardware and Software How Computers Store Data
Introduction CSC 111.
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Computer Programming-1 CSC 111
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

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

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

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

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

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.”); } } 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. ObjectMethodParameters (out object in System class) Whenever you call a method in Java, you need to specify these 3 items

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.

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

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

Compiling a Simple Program Using a dialog box to prompt for information: public class DialogViewer { public static void main (String[] args) { 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. Whatever you entered would be assigned to the name variable This method brings up an input dialog box which displays a prompt and waits for user to enter data into it Prompt Parameter User input is assigned to this 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 At the end, display the following dialog message: Thank you for entering your name and address