1 CS1110. Lecture 1, 31 Aug 2010. Types, expressions, variables, assignment statements Can’t install DrJava and running a Microsoft operating system? Contact.

Slides:



Advertisements
Similar presentations
Introduction to Programming
Advertisements

Lecture 2 Calling and Defining Methods in Java. Introduction ●Calling and defining methods ●Declaring and defining a class ●Instances of a class ●The.
1 CS100J. Lecture 2, 25 January 2007 Today’s topic: Objects and classes Reading for this lecture: Section 1.3. It’s most important that you study this.
CS100J Today’s topic: Objects and classes Reading for this lecture: Section 1.3 PLive: Activities 3-3.1, 3-3.2, (not 3-3.3), 3-4.1, Summary.
Lecture 3: Topics If-then-else Operator precedence While loops Static methods Recursion.
0 CS100J September 2007 CS100J: 12 weeks programming using Java, 2 using Matlab. David Gries. CS100M: 7 weeks of Matlab and 7 of Java. Daisy Fan. CS100H:
ECE122 L7: Conditional Statements February 20, 2007 ECE 122 Engineering Problem Solving with Java Lecture 7 Conditional Statements.
1 MATERI PENDUKUNG OPERATOR Matakuliah: M0074/PROGRAMMING II Tahun: 2005 Versi: 1/0.
COMP 14: Primitive Data and Objects May 24, 2000 Nick Vallidis.
CS 240 – Computer Programming I Lab Kalpa Gunaratna –
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
1 CS1130 Spring 2011: David Gries & Walker White Transition to Object-Oriented Programming Assumes programming knowledge in a language like Matlab, C,
1 CS1110 Fall 2011: David Gries & Steve Marschner CS1112: Matlab No prior programming experience One semester of calculus Math- & engineering- type problems.
CSE 131 Computer Science 1 Module 1: (basics of Java)
Quote for the day: Computational thinking: a fundamental skill for everyone … [It] is … choosing an appropriate representation for a problem or modeling.
Chapter 9 Interactive Multimedia Authoring with Flash - Introduction to Programming “Computers and Creativity” Richard D. Webster, COSC 109 Instructor.
Lecture 2 - Variables, program execution, calculations, print() COMPSCI 101 Principles of Programming.
1 CS1110 Fall 2010 Instructors: David Gries & Lillian Lee CS1112: Matlab No prior programming experience One semester of calculus Math- & engineering-
Chapter 8 High-Level Programming Languages (modified by Erin Chambers)
Imperative Programming
Computing with Numbers CSC 161: The Art of Programming Prof. Henry Kautz 9/14/2009.
1 CS 177 Week 5 Recitation Slides Loops. 2 Announcements Project 2 due next Thursday at 9PM. Exam 1 this evening (switch and loop not covered) Old exams.
Quote for the day: Computational thinking: a fundamental skill for everyone … [It] is … choosing an appropriate representation for a problem or modeling.
CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.
CS 106 Introduction to Computer Science I 01 / 25 / 2010 Instructor: Michael Eckmann.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
A1 Visual C++.NET Intro Programming in C++ Computer Science Dept Va Tech August, 2002 © Barnette ND & McQuain WD 1 Quick Introduction The following.
CSE 113 Introduction to Computer Programming Lecture slides for Week 2 Wednesday, September 7 th, 2011 Instructor: Scott Settembre.
CS100J Spring 2006 CS100J: 11 weeks of programming using Java and 2 weeks using Matlab. David Gries is teaching CS100J. Graeme Bailey is teaching a special.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #005 (April somthin, 2015)
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
1 CS1110 Fall 2011 David Gries, Steve Marschner Reading for this lecture and previous lecture: Sections 1.1, 1.2, 1.3. Lab 1 will give you practice with.
1 CSE1301 Computer Programming: Revision. 2 Topics Type of questions What do you need to know? About the exam Exam technique Staff consultation Revision.
1 CS1110. Lecture 1, 31 Aug Types, expressions, variables, assignment statements Summary of lectures : On course webpage, click on “Lecture summaries”.
1 CS1110 lecture 4 9 Sept. Customizing a class & testing Classes: fields; getter & setter methods. Secs (p. 45) & 3.1 (pp. 105–110 only) Constructors.
1 CS1100 Fall Instructor: David Gries CS100M: Matlab No prior programming experience One semester of calculus Math & engineering type problems CS100J:
1 CS1110 Fall Instructors: David Gries & Lillian Lee CS1112: Matlab No prior programming experience One semester of calculus Math- & engineering-
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Variables and Functions Alice. Naming is Important If you get a new pet one of the first things you do is name it Gives you a way to refer to the new.
COIT29222 Structured Programming 1 COIT29222-Structured Programming Lecture Week 02  Reading: Textbook(4 th Ed.), Chapter 2 Textbook (6 th Ed.), Chapters.
1 CS 101 Today’s class will begin about 5 minutes late We will discuss the lab scheduling problems once class starts.
Principled approach to teaching OO first David Gries Computer Science, Cornell 1.
1 CS September 2008 Discussion of Methods: Executing method calls.If-statements. The return statement in a function. Local variables. For this and.
1 CS1110. Lecture 2, 28 Jan Objects & classes PLive: Activities 3-3.1, 3-3.2, (not 3-3.3), 3-4.1, Summary of lectures: On course page,
Expressions and Order of Operations Operators – There are the standard operators: add, subtract, divide, multiply – Note that * means multiply? (No times.
Copyright Curt Hill The Assignment Operator and Statement The Most Common Statement you will use.
1 CS100J Spring Instructor: David Gries CS100M: Matlab No prior programming experience One semester of calculus Math & engineering type problems.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #003 (February 14, 2015)
Copyright © Curt Hill The Assignment Operator and Statement The Most Common Statement you will use.
1 CS Sept Customizing a class & testing Quote for the day: There is no reason anyone would want a computer in their home. - -Ken Olson, founder.
CMSC201 Computer Science I for Majors Lecture 05 – Comparison Operators and Boolean (Logical) Operators Prof. Katherine Gibson Prof. Jeremy.
C++ LANGUAGE MULTIPLE CHOICE QUESTION
Information and Computer Sciences University of Hawaii, Manoa
CMSC201 Computer Science I for Majors Lecture 05 – Comparison Operators and Boolean (Logical) Operators Prof. Katherine Gibson Based on slides by Shawn.
CS1110 Spring Instructor: David Gries
EGR 2261 Unit 4 Control Structures I: Selection
CS100J. Lecture 2, 24 September Objects & classes
CS190/295 Programming in Python for Life Sciences: Lecture 1
Introduction to Python and programming
Lesson 1: Fundamentals of Programming
College of Computer Science and Engineering
CS 1110 Please do this now. Draw three variables on a piece of paper as shown to the right: b 4 c 7 d false Below is a “program” consisting of 3 assignment.
Coding Concepts (Basics)
CS139 October 11, 2004.
Testing and Repetition
SE1H421 Procedural Programming LECTURE 4 Operators & Conditionals (1)
CISC101 Reminders Labs start this week. Meet your TA! Get help with:
CS100J CS100M is in Kimball Bll.
Basic Programming Concepts
Introduction to Python and programming
Presentation transcript:

1 CS1110. Lecture 1, 31 Aug Types, expressions, variables, assignment statements Can’t install DrJava and running a Microsoft operating system? Contact TA Prabhjeet Singh, Quote for the day: Computers in the future may weigh no more than 1.5 tons. --Popular Mechanics, forecasting the relentless march of science, 1949 Not getting from us via the CS1110 CMS? Then either: 1. You are not registered in the CMS. Maria Witlox and ask her to register you. She needs your 2. Your is bouncing: (some are: tariq.mozaini, lukeg432, dc.mcmurtry10, khyjhcho,com, cabooserwar, lacktora4546). Your Cornell information is not set up correctly or the place to which you forward it is having trouble. Best thing to do: yourself, at see what happens, and fix Orange: update from handout

Interlude: Why learn to program? (which is subtly distinct from, although a core part of, computer science itself) 2 From the Economist: “Teach computing, not Word” Like philosophy, computing qua computing is worth teaching less for the subject matter itself and more for the habits of mind that studying it encourages. The best way to encourage interest in computing in school is to ditch the vocational stuff that strangles the subject currently, give the kids a simple programming language, and then get out of the way and let them experiment. For some, at least, it could be the start of a life-long love affair.

Interlude, continued 3 That, for me, sums up the seductive intellectual core of computers and computer programming: here is a magic black box. You can tell it to do whatever you want, within a certain set of rules, and it will do it; within the confines of the box you are more or less God, your powers limited only by your imagination. But the price of that power is strict discipline: you have to really know what you want, and you have to be able to express it clearly in a formal, structured way that leaves no room for the fuzzy thinking and ambiguity found everywhere else in life… The sense of freedom on offer - the ability to make the machine dance to any tune you care to play - is thrilling.

4 Underclass students: Wonder about CS major, what classes to take? Get an upperclass mentor Upperclass students: Want to help? Wonder what's next? Mentor an underclass student or have a PhD/MEng mentor Join ACSU’s peer mentoring program! To obtain or be a mentor Fill out a questionnaire— gmail.com for info ACSU Bowling /Mentor-Mentee Matching Event (please also fill out the questionnaire) Time/Place: Sept 8, 7-9 PM Helen Newman Bowling Alley (basement of HNL) FREE pizza and soda With any major, it is great to have a helping hand

Reading for next time: Sec. 1.3 on classes & objects PLive: Activities 3-3.1, 3-3.2, (not 3-3.3), 3-4.1, You won’t understand it. It may seem hard. It isn’t; it is just new. Scanning the section will help you become familiar with terminology and make Thursday’s lecture seem easier. Learning steadily, in small doses, is superior to cramming every two-three weeks. New terminology class, file drawer object, instance, foldercreating a new object variable, fieldmethod, function, procedure aliasingfunction call, procedure call packageimporting

6 Labs (“discussions”) in the ACCEL LAB 2 nd floor - Mandatory Using your own laptop with DrJava installed will make it easier for everyone to fit in the room(s)!!! ACCEL Lab: in the Engineering Library in Carpenter Hall: walk straight ‘til you come to a staircase on your left, go up the stairs. Look for the staff, who’ll be wearing distinctive headgear. Couldn’t register for the lab you want? Just go to the one you want this week. Times of the labs: Attend ONE of them. Tuesday:12:20, 1:25, 2:30, 3:35 Wednesday:12:20, 1:25, 2:30, 3:35 - currently undersubscribed

7 Terminology Programming language (Java, C, Fortran, Matlab, Python): a language in which programs are written, usually to be executed (carried out, performed) on a computer. Program: A set of instructions, written in a programming language, to be executed to get some task done. Like a recipe in a cookbook. Machine language. The language of instructions that a computer is able to execute (carry out, perform). Java Compiler. A program that translates a Java program into a machine language form so that it can be executed on a computer.

8 Precedence of operators (p. 23) Unary operators: + – ! (int) (double) Binary arithmetic: * / % Binary arithmetic: + – Arithmetic relations: = Equality relations: == != Logical and: && Logical or: | | You will practice working with types and operators in Lab 01.

9 Type: A set of values together with operations on them. Type double: values: Examples: –22.51E6 equivalent to – or –22.51 * E–6 equivalent to or * 10 –6 An approximation to the real numbers. operators: +, –, *, /, unary – exponentmantissa Type boolean values: true false operators: and && or || not ! Type String values: Example: “the” operator: + (catenation)

iClicker experiment 10 Q1: If you are planning to attend a lab today, which one? (A) 12:20 (B) 1:25 (C ) 2:30 (D) 3:35 Q2: Otherwise, you’re planning to attend a lab tomorrow; in which case, which one? (A) 12:20 (B) 1:25 (C ) 2:30 (D) 3:35 We sent about registering your iClicker yesterday via CMS (if you didn’t get it, see slide one). Is your iClicker on? Have you pulled out the transparent tab from the battery compartment?

11 Variables. p. 26 A variable is a name together with a value. A variable is a named box with a value in the box. 5 Memorize definition! Write it down several times. xvariable x, with value 5. It can contain an int value. int 20.1 areavariable area, with value It can contain a double value. double

12 Declaration of a variable. p. 26 In Java, a declaration of a variable gives the name of the variable and the type of value it can contain. Memorize these two definitions! Write them down several times. int x;Declaration of x, indicating that it contain an int value. double area;Declaration of area, indicating that it can contain a double value. Assignment statement. p. 27 Execution of an assignment statement stores a value in a variable. x= x + 1;Evaluate expression x+1 and store its value in variable x. To execute the assignment = ; evaluate expression and store its value in variable.

13 Two aspects of a programming language Organization – structure Procedural —commands to do something Example: Recipe book Organization: Several options; here is one: Appetizers list of recipes Beverages list of recipes Soups list of recipes … Procedural: Recipe: sequence of instructions to carry out structural objects classes methods inheritance procedural assignment, return, if-statement iteration (loops) recursion miscellaneous GUIs exception handling Testing/debugging Parts to this course

How lost (or found) do you feel regarding what we did today? 14 (A) Much too slow. I know it all (B) A bit too slow, speed up a bit (C) Exactly the right speed (D) Too fast (E) Much much too fast. Slow down! Extremely hard, I am lost