The Computer System. Hardware = Physical Computer. Software = Computer Programs. People = End Users & Programmers. people

Similar documents
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 Java

Chapter 1 Introduction to Computers, Programs, and Java

Introduction to Java Programming

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

Getting Started with Java. Atul Prakash

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

Module 1: Introduction to Computers, Programs, and Java

Chapter 1 Introduction to Computers, Programs, and 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

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

Lecture 1: Introduction to Java

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

Introduction to Computers and Java

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

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

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

Chapter 1 Introduction to Computers, Programs, and Java

JVM interprets the Java bytecode, controls how it interacts with the operating system and manages memory.

Setting up your Computer

Programming with Java

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

Introduction to Java. Lecture 1 COP 3252 Summer May 16, 2017

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

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

CHAPTER 1. Introduction to JAVA Programming

CSC116: Introduction to Computing - Java

Certified Core Java Developer VS-1036

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 1

Chapter 1 Introduction to Computers, Programs, and Java

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

MEAP Edition Manning Early Access Program Get Programming with Java Version 1

Introduction to Computers and Java

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

CSC116: Introduction to Computing - Java

Chapter 1 Introduction to Computers, Programs, and Java

Introduction to Computers and Java

An Introduction to Software Engineering. David Greenstein Monta Vista High School

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

Introduction to JAVA Programming Language

Chapter 1 Introduction to Computers, Programs, and Java

II. Compiling and launching from Command-Line, IDE A simple JAVA program

Chapter 1: Introduction to Computers, Programs, and Java

Chapter 1 Introduction to Computers, Programs, and Java

Lesson 01 Introduction

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

Notepad++ The COMPSCI 101 Text Editor for Windows. What is a text editor? Install Python 3. Installing Notepad++

Chapter 1: Introduction to Computers and Programming

Life Without NetBeans

Programming 1 - Honors

Eng. Mohammed S. Abdualal

How to Install (then Test) the NetBeans Bundle

CSC116: Introduction to Computing - Java

For live Java EE training, please see training courses at

Getting Started with Eclipse/Java

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG

Chapter 1. Introduction to Computers and Java Objects. Background information. » important regardless of programming language. Introduction to Java

This lecture will take you through simple and practical approach while learning Java Programming language.

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

Introduction to Computers and Java

The Programming Process Summer 2010 Margaret Reid-Miller

Computer Principles and Components 1

Introduction to Computers and Programming Languages. CS 180 Sunil Prabhakar Department of Computer Science Purdue University

Week 2: Data and Output

Eclipse Tutorial. For Introduction to Java Programming By Y. Daniel Liang

lejos NXJ Problem Solving with Robots [PRSOCO601]

COMP Computer Basics. Yi Hong May 13, 2015

Setup and Getting Startedt Customized Java EE Training:

Chapter 1 Introduction to Computers, Programs, and Java

RTMS - Software Setup

Computer Programming-1 CSC 111. Chapter 1 : Introduction

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

Chapter 1 INTRODUCTION

1. Introduction. Java. Fall 2009 Instructor: Dr. Masoud Yaghini

Chapter 1 Lab Algorithms, Errors, and Testing

GETTING STARTED. The longest journey begins with a single step. In this chapter, you will learn about: Compiling and Running a Java Program Page 2

Java Manuals For Windows Xp Latest Version 6.1

Introduction to Java

Introduction to Computers and Java

Purpose. Why use Java? Installing the Software. Java

Objects and Classes Lecture 1

CS 170 Java Tools. Step 1: Got Java?

Java Programming Language Mr.Rungrote Phonkam

Installing Eclipse (C++/Java)

Lesson 2: First Java Programs

Lecture 1 - Introduction (Class Notes)

Software Installation for CS121

Fundamentals of Programming. By Budditha Hettige

Instructor s Notes Web Data Management Web Client/Server Concepts. Web Data Management Web Client/Server Concepts

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

Before you start working with Java, you need to set up a Java development

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

Chapter 11 Program Development and Programming Languages

Appendix A: Courseware setup

USING THE OOSIML/JAVA COMPILER. With the Command Window

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

Introduction to Java. Nihar Ranjan Roy.

Java Puzzle Ball Nick Ristuccia

Transcription:

The Computer System Hardware = Physical Computer The equipment associated with a computer system. hardware software people The set of instructions that tell a computer what to do. Use the power of the computer for some purpose. Computers process and communicate using Data Secondary Storage Input Processor Output Input receives data (keyboard, mouse) Processor processes data (CPU, RAM Memory) Output produces information (Monitor, Printer) Secondary storage (Hard Drive, CD) People communicate using Information Copyright 2012 R.M. Laurie 1 Copyright 2012 R.M. Laurie 2 People = End Users & Programmers End User's Utilize computer resources Utilize software applications Programmers Analyze a problem and create a solution algorithm Code the solution algorithm into a specific programming language Verify program works using known test data Software = Computer Programs Program: A set of step by step instructions that direct the computer to do a task that you want it to do and produce the results you want. Programming Language: A set of rules that instructs the computer what operations to perform. Copyright 2012 R.M. Laurie 3 Copyright 2012 R.M. Laurie 4 Copyright 2012 R.M. Laurie 1

Programming Language Generations 1 st = Machine Language Actual bits that CPU processes 2 nd = Assembly Language Each assembly instruction corresponds to one machine code instruction Requires an assembler to convert assembly source code to machine code 3 rd = High-level Language Uses human words for keywords Abstract and general purpose Requires a compiler or interpreter to run MC6809 Simple 8-bit Computer All Computer Systems contain minimally one CPU (Central Processor Unit) and Memory that are interconnected by the data, address, and control buses Compiles for different CPU's Copyright 2012 R.M. Laurie 5 Copyright 2012 R.M. Laurie 6 First Generation: Machine Language Second Generation: Assembly Language Lowest level programming language because it represents data and program instructions as binary 0/1. Generally, hexadecimal is used for human interaction. All programming languages are eventually converted into machine language. Will be run on only one type of CPU 0000 D000 86 D001 12 D002 8B D003 0C D004 B7 D005 D1 D006 00 D007 BB D008 D1 D009 10 D00A B7 D00B D1 D00C 01 FFFF Address Instructions Data D000 86 12 D002 8B 0C D004 B7 D100 D007 BB D110 D00A B7 D101 D00D 8B 1E D00F B7 D01B D012 86 00 D014 B7 D110 D017 23 D007 D01A 3F Assembly Language LDA #$12 ADDA #$0C STA $D100 ADDA $D110 STA $D101 ADDA #$1E BCC $D019 LDA #$00 STA $D110 BRA $D007 SWI Copyright 2012 R.M. Laurie 7 Copyright 2012 R.M. Laurie 8 Copyright 2012 R.M. Laurie 2

Third Generation: High-Level Language 1. // The File Name for this program is JavaExample1.java 2. import java.util.scanner; // Imports Scanner class 3. public class JavaExample1 // Class has same name as file 4. { 5. // Program run starts here at public main method 6. public static void main(string[] args) 7. { 8. Scanner inpentry = new Scanner(System.in); 9. System.out.println("Enter your first name: "); 10. String sfirstname = inpentry.nextline(); 11. System.out.println("Enter your last name: "); 12. String slastname = inpentry.nextline(); 13. inpentry.close(); 14. System.out.println("\n" + sfirstname + " your name " 15. + "will appear as follows on the enrollment list:\n" 16. + slastname + ", "+ sfirstname); 17. } 18. } Copyright 2012 R.M. Laurie 9 High-Level Languages to Machine Code Compiler Converts HLL Source Code into Machine Code file Compiler targets only one type CPU Intel: x86, 386, 486, Pentium 1-4 Motorola: 68k, Power PC, 68HC11 Compiler targets only one type OS Microsoft: DOS, Windows Unix, Linux, Solaris OS, Apple Macintosh, CPM Interpreter Executes HLL Source Code line by line directly Scripting Languages such as JavaScript, Python, Ruby, or BASIC utilize an interpreter to execute programs Excellent portability Copyright 2012 R.M. Laurie 10 Historical Development of HLL FORTRAN: 1957, Compiled language, Developed for engineering and science applications. COBOL: 1959, Compiled language, Developed for business applications. BASIC: 1965, Interpreted language, Easy to program, Personal non-production applications; Resurrected by Microsoft in DOS and Visual Basic. Pascal: 1971, Compiled language, Developed at ETH Switzerland and used by higher education to teach Structured Programming methodologies. C: 1975, Compiled language, Procedural Oriented (verbs), Highly efficient fast programs, Usually eliminated need for assembly language programming. Structured programming. ADA: 1980, Compiled language, Developed as common HLL for Military applications; First to support Multitasking, concurrent execution of Common Object Oriented Languages C++: 1985, Compiled language Added keywords to C so that could be used as Object Oriented Programming language OOP focus is objects (nouns) instead of tasks (verbs) Java: 1994, Pseudo-Compiled language Simplified Object Oriented Programming language Supports Networking and Security Supports Multithreaded for multitasking. Compiler generates Bytecode which runs on JVM Achieves OS and CPU Independence Microsoft C# : 1998, Uses.Net Framework Much closer to Java then C++ and pseudo compiled For Windows only products using Common Language Runtime (CLR like JVM) applications. Structured programming. Copyright 2012 R.M. Laurie 11 Copyright 2012 R.M. Laurie 12 Copyright 2012 R.M. Laurie 3

Java Features Simple Concise and cohesive features Secure Creating Internet applications Portable Any computer with JVM Object Oriented Supports Philosophy Robust Strictly typed and run-time checking Multi-threaded Concurrent processing support High performance Java bytecode is optimized for high speed execution Distributed Designed with network and Internet support in mind Dynamic Verifies and resolves access to objects at run time Copyright 2012 R.M. Laurie 13 How Java Compiles and Runs Programs Text Editor Notepad Source Code filename.java Java Compiler JDK Bytecode filename.class Java Runtime JRE or JVM Running Program Copyright 2012 R.M. Laurie 14 Java Programming Tools The Subfolders of JDK 6 Java Development Kit is the Java Compiler (freeware) Java SE (Standard Edition) Development Kit version 6 update 31 http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u31-download-1501634.html Oracle has now acquired Sun Microsystems Download the version based on the operating system (80 MB) Windows x86 = 32-bit versions (use this one if not sure) Windows x64 = 64-bit versions Linux versions also listed Mac OSX already has JDK installed as part of operating system Java SE Development Kit 6 Documentation Java 6 API (Application Programmers Interface) documentation http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u25-doc-download-355137.html You can Download zip file at link above (58 MB) doc sub-folder can be created within Java JDK folder Searchable Online documentation available at: http://docs.oracle.com/javase/6/docs/ Folder /bin /demo /docs /include /jre /lib /sample Description The Java development tools and commands Demonstration of Java capabilities with several Applets Documentation for JDK can be downloaded and unzipped here C header files for combining C code with Java code Root directory of Java Runtime Environment (JRE) Libraries of code required by the development tools Sample applications using various java components Copyright 2012 R.M. Laurie 15 Copyright 2012 R.M. Laurie 16 Copyright 2012 R.M. Laurie 4

Java Programming Tools NotePad++ (windows) freeware http://notepad-plus-plus.org Freeware text editor can be used for single Java file programs Need to install NppExec plugin and setup. Run using [F6] Can be installed and run from USB drive http://portableapps.com DrJava (All OS s) freeware http://drjava.org Light-weight Integrated Development Environment Can compile and run single java file or multifile project Can be installed and run from USB drive http://portableapps.com Install JPortable and JPortable Launcher Use JPortable Launcher to run drjava.jar file Eclipse IDE (All OS s) freeware http://eclipse.org Heavy-weight Integrated Development Environment Many features, steep learning curve, and requires projects Netbeans IDE (All OS s) freeware http://netbeans.org Heavy-weight Integrated Development Environment Many features, steep learning curve, and requires projects Copyright 2012 R.M. Laurie 17 First Java Program Using NotePad++ or DrJava enter this code and save to USB drive with filename Example2.java 1. // The File Name for this program is Example2.java 2. // Author: Robert Laurie 3. public class Example2 // Class has same name as file 4. { 5. // Program run starts here at public main method 6. public static void main(string[] args) 7. { 8. System.out.println("My first Java Program " 9. + "\nrobert Laurie"); 10. } 11. } C:\Program Files\Java\jdk1.6.0_31\bin\java Example2 Process started >>> My first Java Program Robert Laurie <<< Process finished. Copyright 2012 R.M. Laurie 18 Setting PATH Variable The following is required only if you intend to run java from cmd prompt Proceed with extreme caution! Your system might crash if you make a mistake. 1. Start Control Panel System 2. Click Advanced System Settings 3. Click Environmental Variables 4. Edit Path Variable by inserting the path to the bin folder of your Java installation 5. Each path designator ends with a semicolon and no spaces should exist between them. 6. Click OK and OK 7. You may need to Restart Computer Copyright 2012 R.M. Laurie 19 Running from Command Prompt Window Go to Start All Programs Accessories Command Prompt or go to Start Search and type cmd to open command window Go to Java Programs folder using DOS command cd cd c:\javacode Examine files in folder using DOS command dir dir Compile java program named Example2.java javac Example2.java Examine files to verify Example2.class created use dir Run Java program using JVM without file extension java Example2 Copyright 2012 R.M. Laurie 20 Copyright 2012 R.M. Laurie 5

Edit, Compile, and Run using NotePad++ Install NotePad++ to computer or to PortableApps USB drive Go to menu Plugin > Plugin Manager > Show Plugin Manager Check the checkbox for NPP_Exec plugin > Install > Restart Push [F6] key to access this DOS Execution plugin Enter the in the commands window the two lines: cd "$(CURRENT_DIRECTORY)" c:\program Files\Java\jdk1.6.0_31\bin\javac "$(FILE_NAME)" Click Save, enter Java Compile in Script Name box, and click Save Push [F6] key again to access Npp_Exec plugin Enter the in the commands window the two lines: cd "$(CURRENT_DIRECTORY)" c:\program Files\Java\jdk1.6.0_31\bin\java "$(NAME_PART)" Click Save, enter Java Compile in Script Name box, and click Save Applications, applets, and servlets Application = Program that runs under OS utilizing Java Virtual Machine Applet = Program that runs within a web browser after retrieved from the Internet Servlet = Server-side processing program Copyright 2012 R.M. Laurie 21 Copyright 2012 R.M. Laurie 22 Homework 1 25 points 1. Pick your favorite geometry formula (e.g., area of a square, perimeter of a triangle ) and implement it in Java. Also display your name as the author of the program in the output. 2. Create a program document YourName_hw1.doc with Title Page and create a Program Design section to include program specifications, test data, input/output, and design using flowcharts or pseudo-code. 3. Implement your program design using NotePad++ or DrJava and name your file YourName_hw1.java 4. Compile using Java SE 6 JDK compiler and debug until all syntax errors are eliminated: javac YourName_hw1.java 5. Note upon successful compile javac creates the file YourName_hw1.class 6. Demonstrate your code runs without logic errors by running the Java Virtual Machine on program: java YourName_hw1 7. Create a Program Implement section in YourName_hw1.doc and place your source code in this section. Do a screen capture or text copy of the output of your program and paste in this section. 8. Print out the YourName_hw1.doc word document and be ready to submit this for grading at the end of Class 2, Week 2. Copyright 2012 R.M. Laurie 23 Copyright 2012 R.M. Laurie 6