Elementary Computer Programming

Similar documents
Introduction to programming

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1

Chapter 1 Fundamentals of Java Programming

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language

Building Java Programs

Lab Experience 17. Programming Language Translation

CHAPTER 1 ENGINEERING PROBLEM SOLVING. Copyright 2013 Pearson Education, Inc.

1) Which of the following is a constant, according to Java naming conventions? a. PI b. Test c. x d. radius

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

2 Introduction to Java. Introduction to Programming 1 1

Java CPD (I) Frans Coenen Department of Computer Science

Introduction to Java Applications Pearson Education, Inc. All rights reserved.

Chapter 1 Java Program Design and Development

Crash Course in Java

C# and Other Languages

CS 106 Introduction to Computer Science I

J a v a Quiz (Unit 3, Test 0 Practice)

First Java Programs. V. Paúl Pauca. CSC 111D Fall, Department of Computer Science Wake Forest University. Introduction to Computer Science

Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

Python Programming: An Introduction to Computer Science

CSE 452: Programming Languages. Acknowledgements. Contents. Java and its Evolution

The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. Oct 2003 Presented to Gordon College CS 311

Tutorial: Getting Started

Java Programming. Binnur Kurt Istanbul Technical University Computer Engineering Department. Java Programming. Version 0.0.

Chapter 1 Introduction to Computers, Programs, and Java

Debugging. Common Semantic Errors ESE112. Java Library. It is highly unlikely that you will write code that will work on the first go

Manual For Using the NetBeans IDE

Computer Literacy. Hardware & Software Classification

Programming Languages CIS 443

An Introduction to Computer Science and Computer Organization Comp 150 Fall 2008

1001ICT Introduction To Programming Lecture Notes

Introduction to Java

Python Programming: An Introduction to Computer Science

Installing Java. Table of contents

Building Java Programs

EKT150 Introduction to Computer Programming. Wk1-Introduction to Computer and Computer Program

LAB4 Making Classes and Objects

Tutorial 0A Programming on the command line

Master of Sciences in Informatics Engineering Programming Paradigms 2005/2006. Final Examination. January 24 th, 2006

CSE4213 Lecture Notes

Cambridge International AS and A Level Computer Science

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage

02 B The Java Virtual Machine

Simple Java Applications

Objectives. Python Programming: An Introduction to Computer Science. Lab 01. What we ll learn in this class

Java Basics: Data Types, Variables, and Loops

Java Crash Course Part I

Online Recruitment System 1. INTRODUCTION

EMC Publishing. Ontario Curriculum Computer and Information Science Grade 11

Jonathan Worthington Scarborough Linux User Group

Chapter 1. Introduction to Computers, Programs, and Java

S7 for Windows S7-300/400

Software. Programming Language. Software. Instructor Özgür ZEYDAN. Bülent Ecevit University Department of Environmental Engineering

lesson 1 An Overview of the Computer System

qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq

language 1 (source) compiler language 2 (target) Figure 1: Compiling a program

Parsing Technology and its role in Legacy Modernization. A Metaware White Paper

AP Computer Science Java Mr. Clausen Program 9A, 9B

CSC230 Getting Starting in C. Tyler Bletsch

How to use the Eclipse IDE for Java Application Development

OPERATING SYSTEM SERVICES

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

International Engineering Journal For Research & Development

Parts of a Computer. Preparation. Objectives. Standards. Materials Micron Technology Foundation, Inc. All Rights Reserved

Introduction to Programming

GETTING STARTED WITH ANDROID DEVELOPMENT FOR EMBEDDED SYSTEMS

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

Contents. Java - An Introduction. Java Milestones. Java and its Evolution

How to create/avoid memory leak in Java and.net? Venkat Subramaniam

Lesson 06: Basics of Software Development (W02D2

Programming Languages

Chapter 3. Input and output. 3.1 The System class

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Let s put together a Manual Processor

Chapter 13: Program Development and Programming Languages

Moving from CS 61A Scheme to CS 61B Java

The programming language C. sws1 1

An Android-based Instant Message Application

Topics. Parts of a Java Program. Topics (2) CS 146. Introduction To Computers And Java Chapter Objectives To understand:

INTRODUCTION TO JAVA PROGRAMMING LANGUAGE

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware

The Design of the Inferno Virtual Machine. Introduction

CS3600 SYSTEMS AND NETWORKS

Problem Solving. Software Engineering. Behavior. OCD in a Nutshell. Behavior. Objects Operations Algorithm. Object-Centered Design

Effective Java Programming. efficient software development

Introduction to Object-Oriented Programming

CS 40 Computing for the Web

Basic Java Constructs and Data Types Nuts and Bolts. Looking into Specific Differences and Enhancements in Java compared to C

Language Evaluation Criteria. Evaluation Criteria: Readability. Evaluation Criteria: Writability. ICOM 4036 Programming Languages

The Java Virtual Machine (JVM) Pat Morin COMP 3002

Third AP Edition. Object-Oriented Programming and Data Structures. Maria Litvin. Gary Litvin. Phillips Academy, Andover, Massachusetts

Part I. Multiple Choice Questions (2 points each):

Figure 1: Graphical example of a mergesort 1.

Computer Basics: Chapters 1 & 2

Computer Programming. Course Details An Introduction to Computational Tools. Prof. Mauro Gaspari:

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Transcription:

CSE 201 Elementary Computer Programming CSE 201 Elementary Computer Programming 1 Computer Basics Computer system: hardware + software Hardware: the physical components Software: the instructions that tell the hardware what to do CSE 201 Elementary Computer Programming 2

Common Hardware Components Input Devices (such as mouse and keyboard) Standard Hardware Organization Memory (main & auxiliary) Processor (CPU) Output Devices (such as video display or printer) Processor (CPU) Central Processing Unit Interprets and executes the instructions Memory main & auxiliary holds data and instructions Input nput device(s) mouse, keyboard, etc. Output utput device(s) video display, printer, etc. CPU and memory are physically housed together CSE 201 Elementary Computer Programming 3 Running a Program Program a a set of instructions for a computer to follow Program Data (input for the program) Computer Output CSE 201 Elementary Computer Programming 4

Programming Languages Needed to write software High-level languages (e.g., Java) relatively easy for people to write and understand not directly understood by computers Low-level languages (machine language) directly understood by computer computer-dependent CSE 201 Elementary Computer Programming 5 The Compiler A program written in a high-level language (know as the source code) ) cannot be executed directly by the computer A compiler is a program that translates source code into machine code that does the same thing (known as the object code) CSE 201 Elementary Computer Programming 6

Java Program Translation and Execution Input to Java Program Java Source Code Java Compiler Java Byte-Code Java Virtual Machine Output of Java Program CSE 201 Elementary Computer Programming 7 Java Translation/Execution cont. Java byte-code is portable (hardware- independent) The Java Virtual Machine (JVM) executes Java byte-code on a real machine The java compiler is called javac The JVM emulator is called java CSE 201 Elementary Computer Programming 8

Algorithmic Thinking Algorithm - a set of instructions (steps) for solving a problem. must be precise must be complete can be written in an arbitrary notation (e.g., natural language, programming language, diagram, mix, etc.) Algorithmic thinking is fundamental to computer science and programming CSE 201 Elementary Computer Programming 9 Example of an Algorithm Algorithm that determines the total cost of a list of items: 1. Write the number 0 on the blackboard. 2. Do the following for each item on the list: a. Add the cost of the item to the number on the blackboard. b. Replace the old number on the board by this sum. 3. Announce that the answer is the number written on the board. CSE 201 Elementary Computer Programming 10

First Java Program public class FirstProgram { public static void main(string[] args) { System.out.println("Hello out there."); System.out.println("How s it going?"); System.out.println( "Hope you are having a good day."); System.out.println("Good-bye."); } } CSE 201 Elementary Computer Programming 11 Language Syntax Syntax of a language is a set of (grammar) rules that describe the correct way to write sentences (programs) in the language. Programming languages have a very precise syntax: If you break the rules, you ll get one (or more) errors. CSE 201 Elementary Computer Programming 12

Structure of a Java Program // import needed libraries public class ProgramName { public static void main(string[] args) { // statements go here to describe // actions to be taken by the program } } CSE 201 Elementary Computer Programming 13 A Java Statement System.out.println( some message here ); Outputs the message in quotes to the screen (without the quotes) CSE 201 Elementary Computer Programming 14

What Does FirstProgram Do? Take a look at the program and see if you can figure out what the program does. It outputs the following: CSE 201 Elementary Computer Programming 15 Programming Errors Syntax errors violation of language s syntax rules, e.g., misspelling a word, forgetting a ;, etc. Caught by the compiler! Runtime errors execution execution errors, e.g., division by zero. Logical errors the program compiles and runs without runtime errors, but it does not do what it is supposed to. CSE 201 Elementary Computer Programming 16