Programming for Mobile Computing
|
|
- Bryce Richardson
- 5 years ago
- Views:
Transcription
1 1/57 Programming for Mobile Computing EECS 1022 moodle.yorku.ca
2 Labs 2/57 For the things we have to learn before we can do them, we learn by doing them. Aristotle During the labs, carefully read the instructions, try to follow them, consult the lecture slides, but also experiment and ask the teaching assistants for help. Work in teams of two as you can learn from each other.
3 Labs 3/57 Problem An attribute that represents a counter that counts the number of times any of the four buttons is pressed. Use a descriptive name.
4 Labs 3/57 Problem An attribute that represents a counter that counts the number of times any of the four buttons is pressed. Use a descriptive name. What is the type of the attribute?
5 Labs 3/57 Problem An attribute that represents a counter that counts the number of times any of the four buttons is pressed. Use a descriptive name. What is the type of the attribute? Answer int.
6 Labs 3/57 Problem An attribute that represents a counter that counts the number of times any of the four buttons is pressed. Use a descriptive name. What is the type of the attribute? Answer int. What is a descriptive name for the attribute?
7 Labs 3/57 Problem An attribute that represents a counter that counts the number of times any of the four buttons is pressed. Use a descriptive name. What is the type of the attribute? Answer int. What is a descriptive name for the attribute? Answer counter.
8 Labs 4/57 Problem An attribute that represents a counter that counts the number of times any of the four buttons is pressed. Use a descriptive name. How do you declare an attribute?
9 Labs 4/57 Problem An attribute that represents a counter that counts the number of times any of the four buttons is pressed. Use a descriptive name. How do you declare an attribute? Answer private type name;
10 Labs 4/57 Problem An attribute that represents a counter that counts the number of times any of the four buttons is pressed. Use a descriptive name. How do you declare an attribute? Answer private type name; Solution private int counter;
11 Today s Lecture 5/57 Classes Objects
12 Data types: definition 6/57 A data type consists of a name, a set of values, and a set of operations.
13 Data types: example 7/57 name: int values: 0, 1, 1, 2, 2,... operations: +, -, *, /,...
14 How many values of type int are there? 8/57 How many bytes are used to represent a value of type int?
15 How many values of type int are there? 8/57 How many bytes are used to represent a value of type int? Answer 4
16 How many values of type int are there? 8/57 How many bytes are used to represent a value of type int? Answer 4 A byte consists of how many bits?
17 How many values of type int are there? 8/57 How many bytes are used to represent a value of type int? Answer 4 A byte consists of how many bits? Answer 8
18 How many values of type int are there? 9/57 How many bits are used to represent a value of type int?
19 How many values of type int are there? 9/57 How many bits are used to represent a value of type int? Answer 4 8 = 32
20 How many values of type int are there? 9/57 How many bits are used to represent a value of type int? Answer 4 8 = 32 How many different values has a bit?
21 How many values of type int are there? 9/57 How many bits are used to represent a value of type int? Answer 4 8 = 32 How many different values has a bit? Answer 2
22 How many values of type int are there? 10/57 How many values of type int are there?
23 How many values of type int are there? 10/57 How many values of type int are there? Answer } 2 2 {{ 2 } = times
24 Data types: example 11/57 name: int values: [ , ] operations: +, -, *, /,... Note that = 2 31.
25 Operations 12/57 The operations are typed. For example, : (int int) int specifies that the operation takes two values of type int and returns a value of type int.
26 Data types: example 13/57 name: int values: [ , ] operations: + : (int int) int : (int int) int : (int int) int / : (int int) int...
27 Data types: example 14/57 name: boolean values: true, false operations: && : (boolean boolean) boolean : (boolean boolean) boolean! : boolean boolean
28 Primitive types 15/57 What are the names of the five most used primitive types?
29 Primitive types 15/57 What are the names of the five most used primitive types? Answer boolean, char, double, int and long. a a The other three, less used, primitive types are byte, float and short.
30 Location of the robot 16/57 Can the location of the robot be represented as a single value of primitive type?
31 Location of the robot 16/57 Can the location of the robot be represented as a single value of primitive type? Answer No.
32 Programming Paradigms 17/57 Object-oriented programming Imperative programming Functional programming Logic programming Concurrent programming Event-driven programming Constraint programming...
33 Object-Oriented Programming 18/57 Objects as a formal concept in programming were introduced in the 1960s in programming language Simula 67. This language was created by Ole-Johan Dahl and Kristen Nygaard of the Norwegian Computing Center in Oslo.
34 Ole-Johan Dahl 19/57 Ole-Johan Dahl (October 12, 1931 June 29, 2002) was a Norwegian computer scientist and is considered to be one of the fathers of object-oriented programming. source: ifi.uio.no
35 Kristen Nygaard 20/57 Kristen Nygaard (August 27, 1926 August 10, 2002) was a Norwegian computer scientist and is considered to be one of the fathers of objectoriented programming. source: ifi.uio.no
36 Dahl and Nygaard 21/57 In 2001, Ole-Johan Dahl and Kristen Nygaard won the Turing award. The A.M. Turing Award is given annually by the Association for Computing Machinery (ACM) to an individual selected for contributions of a technical nature made to the computing community. The Turing Award is recognized as the highest distinction in Computer Science and Nobel Prize of computing. source: ifi.uio.no
37 Advantages of OOP 22/57 easy to re-use code easy to extend code easy to maintain code easy to test code fits well with the real world... However, (some of) these advantages are debatable. Mordechai Ben-Ari. Objects never?: well, hardly ever! Communications of the ACM, 53(9): 32 35, September 2010.
38 Location of the robot 23/57 How can we represent the location of the robot? (You may use multiple values of primitive type.)
39 Location of the robot 23/57 How can we represent the location of the robot? (You may use multiple values of primitive type.) Answer Its x- and y-coordinate.
40 Location of the robot 23/57 How can we represent the location of the robot? (You may use multiple values of primitive type.) Answer Its x- and y-coordinate. For each datum, what is a descriptive name and an appropriate type?
41 Location of the robot 23/57 How can we represent the location of the robot? (You may use multiple values of primitive type.) Answer Its x- and y-coordinate. For each datum, what is a descriptive name and an appropriate type? Answer x : int y : int
42 How to represent locations? 24/57 How to represent the location (1, 2)?
43 How to represent locations? 24/57 How to represent the location (1, 2)? Answer x 1 y 2
44 How to represent locations? 24/57 How to represent the location (1, 2)? Answer x 1 y 2 How to represent the location (3, 4)?
45 How to represent locations? 24/57 How to represent the location (1, 2)? Answer x 1 y 2 How to represent the location (3, 4)? Answer x 3 y 4
46 How to represent locations? 25/57 All locations are an instance of the following pattern. x y
47 How to manipulate locations? 26/57 If you are given an instance of the pattern x y what kind of questions may you want to ask about this data?
48 How to manipulate locations? 26/57 If you are given an instance of the pattern x y what kind of questions may you want to ask about this data? What is the x-coordinate of this location?
49 How to manipulate locations? 26/57 If you are given an instance of the pattern x y what kind of questions may you want to ask about this data? What is the x-coordinate of this location? What is the y-coordinate of this location?
50 How to manipulate locations? 26/57 If you are given an instance of the pattern x y what kind of questions may you want to ask about this data? What is the x-coordinate of this location? What is the y-coordinate of this location? How does the location change if the robot moves North?
51 How to manipulate locations? 26/57 If you are given an instance of the pattern x y what kind of questions may you want to ask about this data? What is the x-coordinate of this location? What is the y-coordinate of this location? How does the location change if the robot moves North? How does the location change if the robot moves South?...
52 Objects and classes 27/57 What is an object? Answer An instance of a class. What is a class? Answer A blueprint for objects. You often find these circular definitions in textbooks and on the Internet, but they are not particularly helpful.
53 What is a class? 28/57 x y A class contains attributes. Each attribute has a name and a type. x : int y : int
54 What is a class? 29/57 What is the x-coordinate of this location? What is the y-coordinate of this location?... A class contains methods. Each method has a signature and possibly a return type. getx() : int gety() : int
55 What is an object? 30/57 An object is an instance of a class. An object has a state. The state of an object consists of the attributes of the class and their values. x 1 y 2
56 What is an object? 31/57 An object has an identity. This identity is unique. That is, two different objects have different identities. This is an abstract notion. In more concrete terms, you may think of an object s identity as the address in memory where it is stored. Obviously, two different objects cannot be stored at the same memory address.
57 How to create objects? 32/57 int a = 1; int b = 2; Location location = new Location(a, b);
58 How to create objects? 33/57 int a = 1; int b = 2; Location location = new Location(a, b); 0. 8 a b location.
59 How to create objects? 34/57 int a = 1; int b = 2; Location location = new Location(a, b); a b location.
60 How to create objects? 35/57 int a = 1; int b = 2; Location location = new Location(a, b); a 2 b location.
61 How to create objects? 36/ a 2 b location int a = 1; int b = 2; Location location = new Location(a, b);. 206 Location class. 308 Location object. x y
62 How to create objects? 37/ a 2 b location int a = 1; int b = 2; Location location = new Location(a, b);. 206 Location class. 308 Location object 1 x 2 y.
63 How to create objects? 38/ a 2 b 308 location int a = 1; int b = 2; Location location = new Location(a, b);. 206 Location class. 308 Location object 1 x 2 y.
64 Object creation in memory model 39/57 The first time we encounter a class, we allocate a block in memory for the class. Whenever we encounter new, we allocate a block in memory for the object. Whenever we encounter a constructor, we initialize the attributes by putting the values of the attributes in the block of the object.
65 Terminology 40/57 int a = 1; int b = 2; Location location = new Location(a, b); location is the name of a
66 Terminology 40/57 int a = 1; int b = 2; Location location = new Location(a, b); location is the name of a variable.
67 Terminology 40/57 int a = 1; int b = 2; Location location = new Location(a, b); location is the name of a variable. the type of the variable location is
68 Terminology 40/57 int a = 1; int b = 2; Location location = new Location(a, b); location is the name of a variable. the type of the variable location is Location.
69 Terminology 40/57 int a = 1; int b = 2; Location location = new Location(a, b); location is the name of a variable. the type of the variable location is Location. location is also called an object reference.
70 Types 41/57 We distinguish between primitive types: boolean, char, double, int, long, (byte, float, short) and reference types: classes
71 Invoking a method 42/57 Consider the method public type methodname(type 1 parametername 1,..., type n parametername n ) in the class ClassName. This method is invoked as objectreference.methodname(argument 1,..., argument n ) where the type of objectreference is ClassName and argument i is (compatible with) type i.
72 Location API 43/57 The API of the Location class can be found at the URL /api/location.api/franck/Location.html
73 Invoking a method 44/57 How do you create a Location object named first located at (1,2) and get the location north of it and name that object second?
74 Invoking a method 44/57 How do you create a Location object named first located at (1,2) and get the location north of it and name that object second? Answer Location first = new Location(1, 2); Location second = first. north();
75 Invoking a method 45/57 Draw the diagram representing the memory once the execution has reached the end of the following snippet. Location first = new Location(1, 2); Location second = first. north();
76 Answer 46/ first 408 second. 206 Location class. 308 Location object 1 x 2 y. 408 Location object 1 x 1 y.
77 Printing a location 47/57 Is there a method we can use to print the result?
78 Printing a location 47/57 Is there a method we can use to print the result? Answer Yes, public String tostring()
79 Printing a location 47/57 Is there a method we can use to print the result? Answer Yes, public String tostring() How do we invoke this method?
80 Printing a location 47/57 Is there a method we can use to print the result? Answer Yes, public String tostring() How do we invoke this method? Answer String result = location.tostring()
81 Printing a location 48/57 Location first = new Location(1, 2); Location second = first.north(); String result = second.tostring(); output.println(result);
82 Printing a location 49/57 Exercise Draw the diagram representing the memory once the execution has reached the end of the snippet on the previous slide.
83 Solution to exercise. 534 String class 682 String object (1,1) 50/ first 408 second 682 result. 206 Location class. 308 Location object 1 x 2 y. 408 Location object 1 x 1 y
84 ... objects versus object references 51/57 Location f = new Location(); Location g = new Location(); Location h = new Location(1, 2); Location i = new Location(0, 2); Location j = g; Location k = j; At the end of the execution of the above snippet, how many objects are there and how many objects references are there?
85 ... objects versus object references 51/57 Location f = new Location(); Location g = new Location(); Location h = new Location(1, 2); Location i = new Location(0, 2); Location j = g; Location k = j; At the end of the execution of the above snippet, how many objects are there and how many objects references are there? Answer Four objects and six object references.
86 ... objects versus object references Location f = new Location(); Location g = new Location(); Location h = new Location(1, 2); Location i = new Location(0, 2); Location j = g; Location k = j; At the end of the execution of the above snippet, how many objects are there and how many objects references are there? Answer Four objects and six object references. Exercise Draw the diagram representing the memory once the execution has reached the end of the above snippet. 51/57
87 Solution to exercise 52/ f 400 g 500 h 600 i 400 j 400 k 200 Location class 300 Location object 0 x 0 y 400 Location object 0 x 0 y 500 Location object 1 x 2 y 600 Location object 0 x 2 y
88 When are two objects references the same? 53/57 What do we mean by the same? Do they refer to the same object, that is, do they have the same identity? Do they refer to objects with the same state, that is, do their attributes have the same values?
89 When are two objects references the same? 53/57 What do we mean by the same? Do they refer to the same object, that is, do they have the same identity? Do they refer to objects with the same state, that is, do their attributes have the same values? Location one =... Location other = new Location(1, 1); boolean identical = (one == other); boolean same = one.equals(other);
90 When are two objects references the same? 54/57 Location f = new Location(); Location g = new Location(); Location h = new Location(1, 2); Location i = new Location(0, 2); Location j = g; Location k = j; Fill the following table with true (T) and false (F). == f g h i j k f g h i j k
91 When are two objects references the same? 55/57 Answer Location f = new Location(); Location g = new Location(); Location h = new Location(1, 2); Location i = new Location(0, 2); Location j = g; Location k = j; == f g h i j k f T F F F F F g F T F F T T h F F T F F F i F F F T F F j F T F F T T k F T F F T T
92 When are two objects references the same? 56/57 Location f = new Location(); Location g = new Location(); Location h = new Location(1, 2); Location i = new Location(0, 2); Location j = g; Location k = j; Fill the following table with true (T) and false (F). equals f g h i j k f g h i j k
93 When are two objects references the same? 57/57 Answer Location f = new Location(); Location g = new Location(); Location h = new Location(1, 2); Location i = new Location(0, 2); Location j = g; Location k = j; equals f g h i j k f T T F F T T g T T F F T T h F F T F F F i F F F T F F j T T F F T T k T T F F T T
EECS 1001 and EECS 1030M, lab 01 conflict
EECS 1001 and EECS 1030M, lab 01 conflict Those students who are taking EECS 1001 and who are enrolled in lab 01 of EECS 1030M should switch to lab 02. If you need my help with switching lab sections,
More informationObject Oriented Design: Identifying Objects
Object Oriented Design: Identifying Objects Review What did we do in the last lab? What did you learn? What classes did we use? What objects did we use? What is the difference between a class and an object?
More informationDesigning and Implementing Classes Topic 6
Designing and Implementing Classes Topic 6 Don't know much geography Don't know much trigonometry Don't know much about algebra Don't know what a slide rule is for -Sam Cooke AP Computer Science Designing
More informationJavaScript and OOP. Jerry Cain CS 106AJ November 15, 2017 slides courtesy of Eric Roberts
JavaScript and OOP Jerry Cain CS 106AJ November 15, 2017 slides courtesy of Eric Roberts Once upon a time... Object-Oriented Programming The most prestigious prize in computer science, the ACM Turing Award,
More informationChapter 13. Object Oriented Programming
Chapter 13. Object Oriented Programming Byoung-Tak Zhang TA: Hanock Kwak Biointelligence Laboratory School of Computer Science and Engineering Seoul National University http://bi.snu.ac.kr Computer Programming
More informationObject Class. EX: LightSwitch Class. Basic Class Concepts: Parts. CS257 Computer Science II Kevin Sahr, PhD. Lecture 5: Writing Object Classes
1 CS257 Computer Science II Kevin Sahr, PhD Lecture 5: Writing Object Classes Object Class 2 objects are the basic building blocks of programs in Object Oriented Programming (OOP) languages objects consist
More informationRecommended Group Brainstorm (NO computers during this time)
Recommended Group Brainstorm (NO computers during this time) Good programmers think before they begin coding. Part I of this assignment involves brainstorming with a group of peers with no computers to
More informationLecture 8 Classes and Objects Part 2. MIT AITI June 15th, 2005
Lecture 8 Classes and Objects Part 2 MIT AITI June 15th, 2005 1 What is an object? A building (Strathmore university) A desk A laptop A car Data packets through the internet 2 What is an object? Objects
More information3.1 Class Declaration
Chapter 3 Classes and Objects OBJECTIVES To be able to declare classes To understand object references To understand the mechanism of parameter passing To be able to use static member and instance member
More informationCOE318 Lecture Notes Week 4 (Sept 26, 2011)
COE318 Software Systems Lecture Notes: Week 4 1 of 11 COE318 Lecture Notes Week 4 (Sept 26, 2011) Topics Announcements Data types (cont.) Pass by value Arrays The + operator Strings Stack and Heap details
More informationCOMP6700/2140 Objects
COMP6700/2140 Objects Alexei B Khorev and Josh Milthorpe Research School of Computer Science, ANU March 2017 Alexei B Khorev and Josh Milthorpe (RSCS, ANU) COMP6700/2140 Objects March 2017 1 / 15 What
More informationLecture 3. Lecture
True Object-Oriented programming: Dynamic Objects Static Object-Oriented Programming Reference Variables Eckel: 30-31, 41-46, 107-111, 114-115 Riley: 5.1, 5.2 D0010E Object-Oriented Programming and Design
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationCOE318 Lecture Notes Week 3 (Sept 19, 2011)
COE318 Lecture Notes: Week 3 1 of 8 COE318 Lecture Notes Week 3 (Sept 19, 2011) Topics Announcements TurningRobot example PersonAge example Announcements The submit command now works. Quiz: Monday October
More informationJava How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.
Java How to Program, 10/e Education, Inc. All Rights Reserved. Each class you create becomes a new type that can be used to declare variables and create objects. You can declare new classes as needed;
More informationA foundation for programming. Classes and objects. Overview. Java primitive types. Primitive types Creating your own data types
Classes and objects A foundation for programming any program you might want to write objects functions and modules build even bigger programs and reuse code http://www.flickr.com/photos/vermegrigio/5923415248/
More informationLesson 10A OOP Fundamentals. By John B. Owen All rights reserved 2011, revised 2014
Lesson 10A OOP Fundamentals By John B. Owen All rights reserved 2011, revised 2014 Table of Contents Objectives Definition Pointers vs containers Object vs primitives Constructors Methods Object class
More informationCSC Java Programming, Fall Java Data Types and Control Constructs
CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference
More informationCOMP 250 Winter 2011 Reading: Java background January 5, 2011
Almost all of you have taken COMP 202 or equivalent, so I am assuming that you are familiar with the basic techniques and definitions of Java covered in that course. Those of you who have not taken a COMP
More information2. The object-oriented paradigm!
2. The object-oriented paradigm! Plan for this section:! n Look at things we have to be able to do with a programming language! n Look at Java and how it is done there" Note: I will make a lot of use of
More informationComp 248 Introduction to Programming Chapter 4 - Defining Classes Part A
Comp 248 Introduction to Programming Chapter 4 - Defining Classes Part A Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia University, Montreal, Canada These slides has been
More informationCHAPTER 7 OBJECTS AND CLASSES
CHAPTER 7 OBJECTS AND CLASSES OBJECTIVES After completing Objects and Classes, you will be able to: Explain the use of classes in Java for representing structured data. Distinguish between objects and
More informationChapter 4 Defining Classes I
Chapter 4 Defining Classes I This chapter introduces the idea that students can create their own classes and therefore their own objects. Introduced is the idea of methods and instance variables as the
More informationNews and information! Review: Java Programs! Feedback after Lecture 2! Dead-lines for the first two lab assignment have been posted.!
True object-oriented programming: Dynamic Objects Reference Variables D0010E Object-Oriented Programming and Design Lecture 3 Static Object-Oriented Programming UML" knows-about Eckel: 30-31, 41-46, 107-111,
More informationIntroduction to Java Programming
Boaz Kantor Introduction to Computer Science, Fall semester 2009-2010 IDC Herzliya Welcome, geeks! Introduction to Java Programming Plan for today: 1. Before we begin.. 2. What is Java? 3. How to program?
More informationChapter 6 Introduction to Defining Classes
Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of
More informationEECS168 Exam 3 Review
EECS168 Exam 3 Review Exam 3 Time: 2pm-2:50pm Monday Nov 5 Closed book, closed notes. Calculators or other electronic devices are not permitted or required. If you are unable to attend an exam for any
More informationZhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson
Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Introduction History, Characteristics of Java language Java Language Basics Data types, Variables, Operators and Expressions Anatomy of a Java Program
More informationCHAPTER 7 OBJECTS AND CLASSES
CHAPTER 7 OBJECTS AND CLASSES OBJECTIVES After completing Objects and Classes, you will be able to: Explain the use of classes in Java for representing structured data. Distinguish between objects and
More information2. The object-oriented paradigm
2. The object-oriented paradigm Plan for this section: Look at things we have to be able to do with a programming language Look at Java and how it is done there Note: I will make a lot of use of the fact
More information6.092: Java for 6.170
6.092: Java for 6.170 Lucy Mendel MIT EECS MIT 6.092 IAP 2006 1 Course Staff Lucy Mendel Corey McCaffrey Rob Toscano Justin Mazzola Paluska Scott Osler Ray He Ask us for help! MIT 6.092 IAP 2006 2 Class
More informationThe Abstract Behavioral Specification Language
The Abstract Behavioral Specification Language Frank S. de Boer CWI frb@cwi.nl Scientific Meeting CWI, November 29, 2013 How It All Started? Simula (Ole Johan Dahl, Turing award 2001) Credo FP6 project
More informationAgenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java
CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors Agenda
More informationClass object initialization block destructor Class object
In this segment, I will review the Java statements and primitives that relate explicitly to Object Oriented Programming. I need to re-enforce Java s commitment to OOP. Unlike C++, there is no way to build
More informationEECS1710. Announcements. Labtests have been returned Term Test #01 marking is in progress. Next Labtest: Thu Oct 23/Fri Oct 24
EECS1710 Click to edit Master Week text 05, styles Lecture 10 Second level Third level Fourth level Fifth level Fall 2014! Thursday, Oct 09, 2014 1 Announcements Labtests have been returned Term Test #01
More informationDATA STRUCTURES CHAPTER 1
DATA STRUCTURES CHAPTER 1 FOUNDATIONAL OF DATA STRUCTURES This unit introduces some basic concepts that the student needs to be familiar with before attempting to develop any software. It describes data
More informationVARIABLES AND TYPES CITS1001
VARIABLES AND TYPES CITS1001 Scope of this lecture Types in Java the eight primitive types the unlimited number of object types Values and References The Golden Rule Primitive types Every piece of data
More informationJava Classes & Primitive Types
Java Classes & Primitive Types Rui Moreira Classes Ponto (from figgeom) x : int = 0 y : int = 0 n Attributes q Characteristics/properties of classes q Primitive types (e.g., char, byte, int, float, etc.)
More informationChapter 4. Defining Classes I
Chapter 4 Defining Classes I Introduction Classes are the most important language feature that make object oriented programming (OOP) possible Programming in Java consists of dfii defining a number of
More informationJava Classes & Primitive Types
Java Classes & Primitive Types Rui Moreira Classes Ponto (from figgeom) x : int = 0 y : int = 0 n Attributes q Characteristics/properties of classes q Primitive types (e.g., char, byte, int, float, etc.)
More informationCS121/IS223. Object Reference Variables. Dr Olly Gotel
CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors CS121/IS223
More informationITI Introduction to Computing II
ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Inheritance Introduction Generalization/specialization Version of January 20, 2014 Abstract
More informationExam 1 - (20 points)
Exam 1 - (20 points) Answer all of the following questions. READ EACH QUESTION CAREFULLY. Fill the correct bubble on your scantron sheet. Each correct answer is worth 1 point (unless otherwise stated).
More informationJava How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.
Java How to Program, 10/e Copyright 1992-2015 by Pearson Education, Inc. All Rights Reserved. Data structures Collections of related data items. Discussed in depth in Chapters 16 21. Array objects Data
More informationObject-Oriented Programming (OOP) Basics. CSCI 161 Introduction to Programming I
Object-Oriented Programming (OOP) Basics CSCI 161 Introduction to Programming I Overview Chapter 8 in the textbook Building Java Programs, by Reges & Stepp. Review of OOP History and Terms Discussion of
More informationComputational Applications in Nuclear Astrophysics using Java Java course Lecture 4
Computational Applications in Nuclear Astrophysics using Java Java course Lecture 4 Prepared for course 160410/411 Michael C. Kunkel m.kunkel@fz-juelich.de Materials taken from; docs.oracle.com Teach Yourself
More informationCS162: Introduction to Computer Science II. Primitive Types. Primitive types. Operations on primitive types. Limitations
CS162: Introduction to Computer Science II Primitive Types Java Fundamentals 1 2 Primitive types The eight primitive types in Java Primitive types: byte, short, int, long, float, double, char, boolean
More informationJava Primer 1: Types, Classes and Operators
Java Primer 1 3/18/14 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Java Primer 1: Types,
More informationGraphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub
Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java
More informationCMSC131. Library Classes
CMSC131 Designing Classes Library Classes Due to Java being 100% object-oriented, all code must live inside a class but there is some functionality/information that might be best kept in a more central
More informationITI Introduction to Computing II
ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Inheritance Introduction Generalization/specialization Version of January 21, 2013 Abstract
More informationITT8060: Advanced Programming (in F#)
based on slides by Michael R. Hansen ITT8060: Advanced Programming (in F#) Lecture 2: Identifiers, values, expressions, functions and types Juhan Ernits Department of Software Science, Tallinn University
More informationCS 251 Intermediate Programming Methods and Classes
CS 251 Intermediate Programming Methods and Classes Brooke Chenoweth University of New Mexico Fall 2018 Methods An operation that can be performed on an object Has return type and parameters Method with
More informationProgramming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur
Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 43 Dynamic Binding (Polymorphism): Part III Welcome to Module
More informationObject-Oriented Technology. Rick Mercer
Object-Oriented Technology Rick Mercer 1 Object-Oriented Technology: Outline Consider a few ways in which data is protected from careless modification Mention the key features object-oriented style of
More informationCS 251 Intermediate Programming Methods and More
CS 251 Intermediate Programming Methods and More Brooke Chenoweth University of New Mexico Spring 2018 Methods An operation that can be performed on an object Has return type and parameters Method with
More informationSmalltalk: developed at Xerox Palo Alto Research Center by the Learning Research Group in the 1970 s (Smalltalk-72, Smalltalk-76, Smalltalk-80)
A Bit of History Some notable examples of early object-oriented languages and systems: Sketchpad (Ivan Sutherland s 1963 PhD dissertation) was the first system to use classes and instances (although Sketchpad
More informationClass 22: Inheritance
Menu Class 22: Inheritance Objects Review Object-Oriented Programming Inheritance CS50: Computer Science University of Virginia Computer Science David Evans http://www.cs.virginia.edu/evans 2 Objects When
More informationAssoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.
Assoc. Prof. Dr. Marenglen Biba Laboratory Session: Exercises on classes Analogy to help you understand classes and their contents. Suppose you want to drive a car and make it go faster by pressing down
More informationJava Review. Fundamentals of Computer Science
Java Review Fundamentals of Computer Science Link to Head First pdf File https://zimslifeintcs.files.wordpress.com/2011/12/h ead-first-java-2nd-edition.pdf Outline Data Types Arrays Boolean Expressions
More informationChapter 12 Object-Oriented Programming. Starting Out with Games & Graphics in C++ Tony Gaddis
Chapter 12 Object-Oriented Programming Starting Out with Games & Graphics in C++ Tony Gaddis Addison Wesley is an imprint of 2010 Pearson Addison-Wesley. All rights reserved. 12.1 Procedural and Object-Oriented
More informationCOE318 Lecture Notes Week 3 (Week of Sept 17, 2012)
COE318 Lecture Notes: Week 3 1 of 8 COE318 Lecture Notes Week 3 (Week of Sept 17, 2012) Announcements Quiz (5% of total mark) on Wednesday, September 26, 2012. Covers weeks 1 3. This includes both the
More informationProgramming for Mobile Computing
1/32 Programming for Mobile Computing EECS 1022 moodle.yorku.ca Final exam (programming part) 2/32 Final exam (programming part) will take place on Thursday July 27 during lab time. In particular, Lab
More informationAn Introduction To Writing Your Own Classes CSC 123 Fall 2018 Howard Rosenthal
An Introduction To Writing Your Own Classes CSC 123 Fall 2018 Howard Rosenthal Lesson Goals Understand Object Oriented Programming The Syntax of Class Definitions Constructors this Object Oriented "Hello
More informationClasses Classes 2 / 35
Classes 1 / 35 Classes Classes 2 / 35 Anatomy of a Class By the end of next lecture, you ll understand everything in this class definition. package edu. gatech. cs1331. card ; import java. util. Arrays
More informationJAVA GUI PROGRAMMING REVISION TOUR III
1. In java, methods reside in. (a) Function (b) Library (c) Classes (d) Object JAVA GUI PROGRAMMING REVISION TOUR III 2. The number and type of arguments of a method are known as. (a) Parameter list (b)
More information9 Working with the Java Class Library
9 Working with the Java Class Library 1 Objectives At the end of the lesson, the student should be able to: Explain object-oriented programming and some of its concepts Differentiate between classes and
More informationCS Programming I: Arrays
CS 200 - Programming I: Arrays Marc Renault Department of Computer Sciences University of Wisconsin Madison Fall 2017 TopHat Sec 3 (PM) Join Code: 719946 TopHat Sec 4 (AM) Join Code: 891624 Array Basics
More informationSlide 1 CS 170 Java Programming 1
CS 170 Java Programming 1 Objects and Methods Performing Actions and Using Object Methods Slide 1 CS 170 Java Programming 1 Objects and Methods Duration: 00:01:14 Hi Folks. This is the CS 170, Java Programming
More informationProgramming for Mobile Computing
1/22 Programming for Mobile Computing EECS 1022 moodle.yorku.ca Drop deadline 2/22 July 21 Until this date you can drop the course without getting a grade for it and, hence, it will not affect your gpa.
More informationObject Oriented Programming. Week 1 Part 3 Writing Java with Eclipse and JUnit
Object Oriented Programming Part 3 Writing Java with Eclipse and JUnit Today's Lecture Test Driven Development Review (TDD) Building up a class using TDD Adding a Class using Test Driven Development in
More informationRevising CS-M41. Oliver Kullmann Computer Science Department Swansea University. Robert Recorde room Swansea, December 13, 2013.
Computer Science Department Swansea University Robert Recorde room Swansea, December 13, 2013 How to use the revision lecture The purpose of this lecture (and the slides) is to emphasise the main topics
More informationComputer Science II Data Structures
Computer Science II Data Structures Instructor Sukumar Ghosh 201P Maclean Hall Office hours: 10:30 AM 12:00 PM Mondays and Fridays Course Webpage homepage.cs.uiowa.edu/~ghosh/2116.html Course Syllabus
More informationCSCI 355 Lab #2 Spring 2007
CSCI 355 Lab #2 Spring 2007 More Java Objectives: 1. To explore several Unix commands for displaying information about processes. 2. To explore some differences between Java and C++. 3. To write Java applications
More informationContents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance
Contents Topic 04 - Inheritance I. Classes, Superclasses, and Subclasses - Inheritance Hierarchies Controlling Access to Members (public, no modifier, private, protected) Calling constructors of superclass
More informationECE 122. Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Lecture 5 Anatomy of a Class Outline Problem: How do I build and use a class? Need to understand constructors A few more tools to add to our toolbox Formatting
More informationJAVA MOCK TEST JAVA MOCK TEST II
http://www.tutorialspoint.com JAVA MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Java Framework. You can download these sample mock tests at your
More informationCLASSES AND OBJECTS. Fundamentals of Computer Science I
CLASSES AND OBJECTS Fundamentals of Computer Science I Outline Primitive types Creating your own data types Classes Objects Instance variables Instance methods Constructors Arrays of objects A Foundation
More informationLesson 06 Arrays. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL
Lesson 06 Arrays MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL Array An array is a group of variables (called elements or components) containing
More informationTopic 5. Object Oriented Programming. Classes Are...
Topic 5 Implementing Classes And so, from Europe, we get things such... object-oriented analysis and design (a clever way of breaking up software programming instructions and data into small, reusable
More informationObject Oriented Programming(OOP).
Object Oriented Programming(OOP). OOP terminology: Class : A class is a way to bind data and its associated function together. It allows the data to be hidden. class Crectangle Data members length; breadth;
More informationCpt S 122 Data Structures. Course Review Midterm Exam # 2
Cpt S 122 Data Structures Course Review Midterm Exam # 2 Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Midterm Exam 2 When: Monday (11/05) 12:10 pm -1pm
More informationCS162: Introduction to Computer Science II
CS162: Introduction to Computer Science II Java Fundamentals 1 Primitive Types 2 1 Primitive types: Primitive types byte, short, int, long, float, double, char, boolean Example: int size = 42; size is
More informationTopic 5. hierarchies.) The Business Of Software. CS 307 Fundamentals of Computer Science. Implementing Classes 1
Topic 5 Implementing Classes And so, from Europe, we get things such... object-oriented analysis and design (a clever way of breaking up software programming instructions and data into small, reusable
More informationCS112 Lecture: Defining Instantiable Classes
CS112 Lecture: Defining Instantiable Classes Last revised 2/3/05 Objectives: 1. To describe the process of defining an instantiable class 2. To discuss public and private visibility modifiers. Materials:
More informationProgramming Languages and Techniques (CIS120)
Programming Languages and Techniques (CIS120) Lecture 21 March 12, 2018 Java: Objects, Interfaces, Static Members Chapters 19 & 20 Announcements Java Bootcamp Tonight!! Towne 100, 6-8 pm HW06: Pennstagram
More informationCSCI 355 LAB #2 Spring 2004
CSCI 355 LAB #2 Spring 2004 More Java Objectives: 1. To explore several Unix commands for displaying information about processes. 2. To explore some differences between Java and C++. 3. To write Java applications
More information1007 Imperative Programming Part II
Agenda 1007 Imperative Programming Part II We ve seen the basic ideas of sequence, iteration and selection. Now let s look at what else we need to start writing useful programs. Details now start to be
More informationCSE115 / CSE503 Introduction to Computer Science I. Dr. Carl Alphonce 343 Davis Hall Office hours:
CSE115 / CSE503 Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall alphonce@buffalo.edu Office hours: Thursday 12:00 PM 2:00 PM Friday 8:30 AM 10:30 AM OR request appointment via e-mail
More informationCS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class
CS112 Lecture: Defining Classes Last revised 2/3/06 Objectives: 1. To describe the process of defining an instantiable class Materials: 1. BlueJ SavingsAccount example project 2. Handout of code for SavingsAccount
More informationCLASSES AND OBJECTS. Fundamentals of Computer Science I
CLASSES AND OBJECTS Fundamentals of Computer Science I Outline Primitive types Creating your own data types Classes Objects Instance variables Instance methods Constructors Arrays of objects A Foundation
More informationUnit 6 - Software Design and Development LESSON 4 DATA TYPES
Unit 6 - Software Design and Development LESSON 4 DATA TYPES Previously Paradigms Choice of languages Key features of programming languages sequence; selection eg case, if then else; iteration eg repeat
More information1. Describe History of C++? 2. What is Dev. C++? 3. Why Use Dev. C++ instead of C++ DOS IDE?
1. Describe History of C++? The C++ programming language has a history going back to 1979, when Bjarne Stroustrup was doing work for his Ph.D. thesis. One of the languages Stroustrup had the opportunity
More informationData Abstraction: Status of an Object
Data Abstraction: Status of an Object Hsuan-Tien Lin Deptartment of CSIE, NTU OOP Class, March 10, 2009 H.-T. Lin (NTU CSIE) Data Abstraction: Status of an Object OOP(even) 03/10/2009 0 / 50 What We Should
More informationReview questions. Review questions, cont d. Class Definition. Methods. Class definition: methods. April 1,
April 1, 2003 1 Previous Lecture: Intro to OOP Class definition: instance variables & methods Today s Lecture: Instance methods Constructors Methods with input parameters Review questions Where do you
More informationCMPT 117: Tutorial 1. Craig Thompson. 12 January 2009
CMPT 117: Tutorial 1 Craig Thompson 12 January 2009 Administrivia Coding habits OOP Header Files Function Overloading Class info Tutorials Review of course material additional examples Q&A Labs Work on
More informationCurriculum Map Grade(s): Subject: AP Computer Science
Curriculum Map Grade(s): 11-12 Subject: AP Computer Science (Semester 1 - Weeks 1-18) Unit / Weeks Content Skills Assessments Standards Lesson 1 - Background Chapter 1 of Textbook (Weeks 1-3) - 1.1 History
More informationSoftware Design and Analysis for Engineers
Software Design and Analysis for Engineers by Dr. Lesley Shannon Email: lshannon@ensc.sfu.ca Course Website: http://www.ensc.sfu.ca/~lshannon/courses/ensc251 Simon Fraser University Slide Set: 2 Date:
More informationBinghamton University. CS-140 Fall Data Types in Java
Data Types in Java 1 CS-211 2015 Example Class: Car How Cars are Described Make Model Year Color Owner Location Mileage Actions that can be applied to cars Create a new car Transfer ownership Move to a
More informationObject-Oriented Programming and Design
C Sc 335 Course Overview Object-Oriented Programming and Design Rick Mercer Major Topics in C Sc 335 1. Java 2. Object-Oriented Programming 3. Object-Oriented Design 4. Technology 5. Object-Oriented Principles
More information