last time in cs recitations. computer commands. today s topics.

Similar documents
Welcome (back) to CS1007!

cis20.1 design and implementation of software applications I fall 2007 lecture # I.2 topics: introduction to java, part 1

(0) introduction to the course. how to learn a programming language. (0) course structure

Introduction to Computing using C++ Biomedical applications WELCOME TO CIS 1.5. Introduction to the course. Course structure

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

Lab 1 Introduction to UNIX and C

CS2900 Introductory Programming with Python and C++ Kevin Squire LtCol Joel Young Fall 2007

CS 177 Recitation. Week 1 Intro to Java

Basic Computer Programming for ISNE. Santi Phithakkitnukoon ผศ.ดร.ส นต พ ท กษ ก จน ก ร

Lab 1 Introduction to UNIX and C

Section 2.2 Your First Program in Java: Printing a Line of Text

CSC116: Introduction to Computing - Java

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

You should see something like this, called the prompt :

Oregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011

CSC116: Introduction to Computing - Java

CS 241 Computer Programming. Introduction. Teacher Assistant. Hadeel Al-Ateeq

Getting started with Java

CSC116: Introduction to Computing - Java

Refresher workshop in programming for polytechnic graduates General Java Program Compilation Guide

Midterms Save the Dates!

Intermediate Programming, Spring Misha Kazhdan

CSCI 136 Data Structures & Advanced Programming. Spring 2018 Instructors Bill Jannen & Jon Park

today cs3157-fall2002-sklar-lect05 1

COMP s1 Lecture 1

Full file at

Getting Started With UNIX Lab Exercises

Section 2.2 Your First Program in Java: Printing a Line of Text

C++ Programming Language Lecture 1 Introduction

Course Outline. Introduction to java

Check the entries in the home directory again with an ls command and then change to the java directory:

CS4023 Week04 Lab Exercise

CSCI 136 Data Structures & Advanced Programming. Fall 2018 Instructors Bill Lenhart & Bill Jannen

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Getting started with Hugs on Linux

SECTION -C. Getting Started with UNIX

CPS109 Lab 1. i. To become familiar with the Ryerson Computer Science laboratory environment.

Introduction to Linux Environment. Yun-Wen Chen

CS11 Java. Fall Lecture 1

First Java Program - Output to the Screen

Chapter 1 Introduction to Computers and C++ Programming

CSE 391 Lecture 1. introduction to Linux/Unix environment

Object-Oriented Programming

Last Time. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings

Chapter 2: Programming Concepts

Saint Louis University. Intro to Linux and C. CSCI 2400/ ECE 3217: Computer Architecture. Instructors: David Ferry

AMS 200: Working on Linux/Unix Machines

Università degli Studi di Bologna Facoltà di Ingegneria. Principles, Models, and Applications for Distributed Systems M

This is a combination of a programming assignment and ungraded exercises

Tutorial 1: Unix Basics

Room 3P16 Telephone: extension ~irjohnson/uqc146s1.html

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

CSE 391 Lecture 1. introduction to Linux/Unix environment


Fundamentals of Programming. Lecture 1: Introduction to C Programming

Computer Science 62 Lab 8

advanced data types (2) typedef. today advanced data types (3) enum. mon 23 sep 2002 defining your own types using typedef

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

Computer Principles and Components 1

Python for Astronomers. Week 1- Basic Python

1 Getting Started with Linux.

0 Introduction: Computer systems and program development

} Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = / 2; 3. int x = 5 / ; 4. double x = 5 / 2.

CSCI 355 Lab #2 Spring 2007

Physics 306 Computing Lab 1: Hello, World!

assembler Machine Code Object Files linker Executable File

1. Escape Sequences For each of the following snippets of code write down what will be printed on the screen.

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont.

CSE 390a Lecture 1. introduction to Linux/Unix environment

Building Java Programs. Introduction to Programming and Simple Java Programs

CS 11 java track: lecture 1

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

Introduction to Linux Spring 2014, Section 02, Lecture 3 Jason Tang

Java Bytecode (binary file)

Two Types of Types. Primitive Types in Java. Using Primitive Variables. Class #07: Java Primitives. Integer types.

Midterm I - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total.

TTh 9.25 AM AM Strain 322

Week 2: Data and Output

Integer Representation. Variables. Real Representation. Integer Overflow/Underflow

Chapter 1 INTRODUCTION

Using the Zoo Workstations

Interpreted vs Compiled. Java Compile. Classes, Objects, and Methods. Hello World 10/6/2016. Python Interpreted. Java Compiled

Introduction to Java

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic

Programming in Java Prof. Debasis Samanta Department of Computer Science Engineering Indian Institute of Technology, Kharagpur

CSCI 355 LAB #2 Spring 2004

Announcements. 1. Forms to return today after class:

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

INFS 214: Introduction to Computing

Programming. Syntax and Semantics

CMPUT 201: Practical Programming Methodology. Guohui Lin Department of Computing Science University of Alberta September 2018

Object Declaration. <class name>: the name of the class to which the object belongs <object name>: the name of the object (any valid identifier)

AP Computer Science A: Java Programming

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

Using System.out.println()

Programming Studio #1 ECE 190

Getting started with Hugs on Linux

CMSC 201 Spring 2017 Lab 01 Hello World

1 Introduction Java, the beginning Java Virtual Machine A First Program BlueJ Raspberry Pi...

Transcription:

last time in cs1007... recitations. course objectives policies academic integrity resources WEB PAGE: http://www.columbia.edu/ cs1007 NOTE CHANGES IN ASSESSMENT 5 EXTRA CREDIT POINTS ADDED sign up for a recitation (sign up sheet circulating in class) day date time room recitation #1 Mon 9.00am 10.00am 252 ET Dali recitation #2 Mon 7.00pm 8.00pm 407 Math Steve recitation #3 Mon 8.00pm 9.00pm 407 Math Jonah recitation #4 Tue 7.00pm 8.00pm 407 Math Don recitation #5 Wed 12.00pm 1.00pm 252 ET Lyndon recitation #6 Thu 6.00pm 7.00pm 407 Math Min ET = Engineering Terrace starting next week (week of Sep 9) this is where you will get back your homeworks!! cs1007-fall2002-sklar-lect02 1 cs1007-fall2002-sklar-lect02 2 today s topics. computer commands. computer basics creating your first program editing, compiling, linking, running output data types reading: ch 1, ch 2.1-2.4 computer follows commands commands = series of instructions you will learn how to command a computer command = program = write instructions you understand the commands, but does the computer? that s a question of cognition... Artificial Intelligence, Cognitive Science cs1007-fall2002-sklar-lect02 3 cs1007-fall2002-sklar-lect02 4

computer components. computer instructions. computer = hardware + software a computer is organized into logical units: input output memory arithmetic and logic (ALU) central processing (CPU) secondary storage set of instructions = program types of instructions: machine language assembly language high-level language (e.g., C, C++, Java) program is compiled into machine language and then executed (ran) executing (running) program = job = process = task cs1007-fall2002-sklar-lect02 5 cs1007-fall2002-sklar-lect02 6 machine language. assembly language. lowest level numeric computer is comprised of zillions of switches or relays switches = ON or OFF relays = OPEN or CLOSED hardware position is abstracted into software as 1 s and 0 s 1 s and 0 s base 2, or binary medium level, but still pretty low; i.e., hard to read and understand English words and abbreviations examples: LOAD ADD SHIFT STORE cs1007-fall2002-sklar-lect02 7 cs1007-fall2002-sklar-lect02 8

high-level languages. language examples. examples: C, BASIC, FORTRAN, Pascal, C++, Java, LISP, Scheme even more like English high-level languages are 1. compiled into machine language or object code 2. linked into executable code 3. executed or ran as programs machine language: +1300042774 +1400593419 +1200274027 assembly language: LOAD BASEPAY ADD OVERPAY STORE GROSSPAY high-level language: grosspay = basepay + overtimepay; cs1007-fall2002-sklar-lect02 9 cs1007-fall2002-sklar-lect02 10 Java. your first application. Java is an object-oriented language: it is structured around objects and methods, where a method is an action or something you do with the object Java programs are divided into entities called classes some Java classes are native but you can also write classes yourself Java programs can run as applications or applets hello world typical first program in any language output only (no input) cs1007-fall2002-sklar-lect02 11 cs1007-fall2002-sklar-lect02 12

the application source code. output. file name = hello.java /*---------------------------------------------------------- Prof Sklar, 05-Sep-02, hello.java This class demonstrates output from a Java application. ----------------------------------------------------------*/ public class hello { public static void main ( String[] args ) { System.out.println( "hello world!\n" ); } // end of main() } // end of class hello() like filling in graph paper methods System.out.println( ) System.out.print( ) arguments those things inside the parenthesis ( ) one or more Strings, separated by + s escape sequences: n, t also called parameters example System.out.println( "The quick" + ", brown " + "fox" ); cs1007-fall2002-sklar-lect02 13 cs1007-fall2002-sklar-lect02 14 things to notice. try it yourself. Java is CASE sensitive punctuation is really important! whitespace doesn t matter for compilation BUT whitespace DOES matter for readability and your grade! file name is same as class name 1. log into CUNIX 2. create the application source code file, using the emacs editor 3. compile the source code, using the javac command 4. execute the program using the java command cs1007-fall2002-sklar-lect02 15 cs1007-fall2002-sklar-lect02 16

quick and dirty UNIX. quick and dirty emacs. ls cp mv rm cd pwd man chmod UNIX is an operating system, Linux is a version of UNIX command-line interface commands have options, also called switches here are some commands: -- list the files in the current directory -- copy a file -- rename a file -- delete (remove) a file -- change directory -- show the current directory -- help -- change file protections at the UNIX prompt: unix> emacs hello.java emacs is a control key editor here are some commands: Ctrl-B -- move cursor back Ctrl-F -- move cursor forward Ctrl-P -- move cursor to previous line Ctrl-N -- move cursor to next line Ctrl-D -- delete character under cursor Ctrl-X Ctrl-S -- save the file Ctrl-X Ctrl-C -- exit emacs Ctrl-H -- help ESC -- escape! gets you out of trouble! cs1007-fall2002-sklar-lect02 17 cs1007-fall2002-sklar-lect02 18 data types. memory. programs = objects + methods objects = data data must be stored all storage is numeric (0 s and 1 s) think of the computer s memory as a bunch of boxes inside each box, there is a number you give each box a name defining a variable example: program code: int x; computer s memory: x cs1007-fall2002-sklar-lect02 19 cs1007-fall2002-sklar-lect02 20

variables. primitive data types. variables have: name type value naming rules: names may contain letters and/or numbers but cannot begin with a number names may also contain underscore ( ) and dollar sign ($) underscore is used frequently; dollar sign is not too common in Java can be of any length cannot use Java keywords Java is case-sensitive!! numeric byte 8 bits -128 = -2 127 = 2-1 short 16 bits -32,768 = -2 32,767 = -2-1 int 32 bits -2 2-1 long 64 bits -2 2-1 float 32 bits -3.4E+38, 7 sig dig 3.4E+38, 7 sig dig double 64 bits -1.7E+308, 15 sig dig 1.7E+308, 15 sig dig boolean boolean 1 bit character char 16 bits cs1007-fall2002-sklar-lect02 21 cs1007-fall2002-sklar-lect02 22 assignment. to do. = is the assignment operator example: program code: int x; // declaration x = 19; // assignment or int x = 19; computer s memory: x 19 get the textbook, and read chapter 1 and 2.1 2.4 sign up for a rectiation try logging into your CUNIX account check out the class web page: http://www.columbia.edu/ cs1007 Have a good weekend! cs1007-fall2002-sklar-lect02 23 cs1007-fall2002-sklar-lect02 24