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.

Slides:



Advertisements
Similar presentations
1 For more info: CS Sep 2008 In 1968, the Defense Department hired Bolt Beranek and Newman (BBN) of Boston to.
Advertisements

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.
1 CS Sept. Customizing a class & testing Quiz 2 on Tuesday 15 Sept Purpose of a constructor (slide 5) Evaluating a new expression (slide 6) Fields;
I NTRODUCTION TO COSC 1010 (L AB ). I NTRODUCTION How to login in Pascal account How to forward s to a single account Getting to know about Z Drive.
Computers and Society Lecture 1: administrative details and an introduction to the class Professor: Evan Korth New York University.
Cox Personal Web Space (or AOL space) Free Storage for Image Galleries.
Museum Box is a free website that allows users to create a project using cubes to organize information. Users can use text, images, sounds, web links and.
1 CS100J 1 February Customizing a class & testing Quote for the day: There is no reason anyone would want a computer in their home. - -Ken Olson,
What Data Do We Have? Sections 2.2, 2.5 August 29, 2008.
1 Review of classes and subclasses M fast through this material, since by now all have seen it in CS100 or the Java bootcamp First packages Then classes.
Getting Started in Blackboard. You will need… A web browser, preferably Internet Explorer, version 4.0 or higher An account and the knowledge of.
CS100J 11 September 2003 Course Management System for CS100J is now populated with students who were pre-registered. Look at course web page to see how.
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:
CS100J CS100M is in Kimball Bll. Course Management System for CS100J is now populated with students who were pre-registered. Look at course web page to.
1 CS150 Introduction to Computer Science 1 Professor: Chadd Williams
1 CS100J 30 January 2007 The class definition Course Management System (CMS) for CS100J is populated with students who were pre-registered. Look at course.
1 CS100J 05 February 2005 Today’s topic: Customizing a class (continued) Quiz 1 is today Quiz 2 is next Tuesday Quote for the day: There is no reason anyone.
Applets, HTML and GUI’s Recitation – 04/11/2008 CS 180 Department of Computer Science, Purdue University.
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.
Quote for the day: Computational thinking: a fundamental skill for everyone … [It] is … choosing an appropriate representation for a problem or modeling.
Inti Online Login Page (Lecturer/Student/Administrator View)
CS105 Lab 1 – Introduction Section: ??? TA: ??? ??? Announcements CITES Accounts Compass Netfiles Other Administrative Information CS105 Fall
1 CS1110 Fall 2010 Instructors: David Gries & Lillian Lee CS1112: Matlab No prior programming experience One semester of calculus Math- & engineering-
Computer Concepts 7th Edition Parsons/Oja Chapter 3 Computer Software Section A: Software Basics.
9/10/2015 What’s New? Edline at Valley View!! Joyce Potempa Technology Department presentation to Building Support Staff February 2, 2010 Institute Day.
Quote for the day: Computational thinking: a fundamental skill for everyone … [It] is … choosing an appropriate representation for a problem or modeling.
CS161 Topic #21 CS161 Introduction to Computer Science Topic #2.
1 CS Sept 2010 Customizing a class Quote for the day: I have traveled the length and breadth of this country and talked with the best people, and.
CS100J 09 September 2003 Course Management System for CS100J is now populated with students who were pre-registered. Look at course web page to see how.
CSCI-A110 Lab Welcome!. Overview: a busy 1 st day Welcome – Introduction Purpose of the lab Course Structure/Grading Online Course Material (Oncourse)
1 CS1110. Lecture 1, 31 Aug Types, expressions, variables, assignment statements Can’t install DrJava and running a Microsoft operating system? Contact.
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.
0 Teaching Java —with OO first David Gries Computer Science Cornell University Ithaca, NY
CS 101: Introduction to computer programming and utilization Abhiram Ranade.
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.
CS/ENGRD 2110 SPRING 2012 Lecture 2: Objects and classes in Java 1.
CIS101 Introduction to Computing Week 01. Agenda What is CIS101? Class Introductions Using your Pace Introduction to Blackboard and online learning.
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:
What is Programming? Computer programming is about telling the computer what it is we want it to do We tell the computer what we want it to do by sending.
1 CS1110 Fall Instructors: David Gries & Lillian Lee CS1112: Matlab No prior programming experience One semester of calculus Math- & engineering-
January 2006Colby College ITS Setting Up Course Pages.
1 CS100J 08 September 2005 Today’s topic: Customizing a class (continued) Quote for the day: There is no reason anyone would want a computer in their home.
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,
CS/ENGRD 2110 SPRING 2016 Lecture 2: Objects and classes in Java 1.
PHP Form Processing * referenced from
Working with the interface and interacting with the iPad app.
1 CS1110 Thursday, 10 Feb 2011 Discussion of Methods: Executing method calls. If-statements. The return statement in a function. Local variables. For this.
1 CS100J Spring Instructor: David Gries CS100M: Matlab No prior programming experience One semester of calculus Math & engineering type problems.
1 For more info: CS February 2009 In 1968, the Defense Department hired Bolt Beranek and Newman (BBN) of Boston.
JavaScript 101 Lesson 6: Introduction to Functions.
1 CS Sept 2010 Customizing a class Quote for the day: I have traveled the length and breadth of this country and talked with the best people, and.
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.
 Open the course to add an online class  Click on Add a Page (left side)  Type in a name  Click on Create  Click on the Content Tab  Click on Add.
CS/ENGRD 2110 Fall 2017 Lecture 2: Objects and classes in Java
Using the Personal Image Photo Library
CS Feb 2010 Customizing a class
CS1110 Spring Instructor: David Gries
NetApp Online Ordering User Tutorial
CS100J. Lecture 2, 24 September Objects & classes
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.
Sit next to someone. Today, we do some work in pairs.
CS100J 06 September 2005 The class definition
What you will need to Register
Sit next to someone. Today, we do some work in pairs.
CS100J CS100M is in Kimball Bll.
CS Feb 2011 Customizing a class
Presentation transcript:

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 section over the weekend and practice what is taught using DrJava. PLive: Activities 3-3.1, 3-3.2, (not 3-3.3), 3-4.1, Summary of lectures: On course page, click on “Handouts” and then “Outline of lectures held so far”. 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 Quiz on Tuesday. Tell me (1) what a type is, (2) how to execute an assignment statement, (3) how to draw a manilla folder (instance, object) of a class. See course web page for more details.

2 About CMS CMS: Course Management System.Uses to maintain grades, handle submitted assignments, post grades, handle regrades, etc. Developed by the CS Department. Look at this URL: Click on “Secure extended login”, if you see it. You will be asked for your cornell netid and password. After you have entered it, you will either be in the CMS and will see the course description or you will see on the right something like this: CMS Overview My Courses Com S 100J (student) If it lists CS100J, click on it, and you are in the CMS. If it doesn’t, you are not in the CMS; Stacey Shirk at and ask her to register you in the CMS for CS100J.

3 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: A recipe is a sequence of instructions to carry out We begin by studying organization — structure

4 A class is a file-drawer. Contents: manila folders, each containing the same kind of information Bill Patient name B. Clinton address New York owes $ manila folder: an object or instance of the class class name

5 A class is a file-drawer. Contents: manila folders, each containing the same kind of information Bill Patient name B. Clinton address New York owes $ name, address, owes: variables, called fields of the folder

6 A class is a file-drawer. Contents: manila folders, each containing the same kind of information Bill Patient name B. Clinton address New York owes $ Name on tab (Bill): can be anything you want, as long as it is unique

7 A class is a file-drawer. Contents: manila folders, each containing the same kind of information Bill Patient name B. Clinton address New York owes $ Instructions to be carried out by different people: change the name, get the name, bill the patient, receive money from patient, insert teeth xrays into the folder, …

8 A class is a file-drawer. Contents: manila folders, each containing the same kind of information Bill Patient name B. Clinton address New York owes $ Instructions to be carried out by different people: methods. getName is a function; it returns a value. deposit is a procedure; it does some task, doesn’t return value getName() deposit(double d)

9 Bill Patient name B. Clinton address New York owes $ getName() deposit(double d) pat Bill variable contains the name of the folder pat.getName() function call. Its value is “B. Clinton” pat.deposit(250.0); procedure call. Change the value of field owes to 0.

10 Bill Patient name B. Clinton address New York owes $ getName() deposit(double d) pat Bill variable contains the name of the folder new Patient() An expression that creates a new folder, puts it in file-drawer Patient, and gives as its value the name of the folder. pat= new Patient();A statement that creates a new folder, puts it in file-drawer Patient, and stores the name of the folder in variable pat.

11 package: A collection of classes that are placed in the same directory on your hard drive. Think of it as a room that contains file cabinets with one drawer for each class. package java.io classes having to do with input/output package java.net classes having to do with the internet package java.awt classes having to do with making GUIs package javax.swing newer classes having to do with GUIs ============================================= To reference class JFrame in package javax.swing, use: javax.swing.JFrame Instead: import javax.swing.*; Then use simply JFrame

12 The expression new JFrame() creates a new folder that goes in file drawer JFrame. The statement jf= new JFrame(); creates a new folder and places its name in variable jf (jf should have first been declared). Thereafter, use jf. method-name ( arguments, if any ) to call methods of folder (object) jf. Read section 1.3. Practice what you saw in class in DrJava. Try the self-review exercises on page 40.