Object-Oriented Programming

Slides:



Advertisements
Similar presentations
Chapter 14 Graph class design Bjarne Stroustrup
Advertisements

1 CSCE 1030 Computer Science 1 Introduction to Object Oriented Programming.
The Point Class public class Point { public double x; public double y; public Point(double x0, double y0) { x = x0; y = y0; } public double distance(Point.
Mouse Listeners We continue our examination of GUIs by looking at how to interact with the mouse –Just as Java creates Events when the user interacts with.
Copyright 2008 by Pearson Education Building Java Programs Chapter 8 Lecture 8-3: Encapsulation, toString reading: self-checks: #13-18,
Chapter 8. Operator Overloading Operator overloading gives the opportunity to redefine C++ Operator overloading refers to redefine C++ operators such.
Chapter 14 Graph class design John Keyser’s Modifications of Slides by Bjarne Stroustrup
C++ Classes & Data Abstraction
Chapter 4&5 Defining Classes Copyright © 2010 Pearson Addison-Wesley. All rights reserved.
Object Oriented Programming Teguh Sutanto Si | STIKOM Surabaya
1 Classes Overview l Classes as Types l Declaring Instance Variables l Implementing Methods l Constructors l Accessor and Mutator Methods.
1 Lecture 06(Abstract Classes)Lecture 9 Abstract Classes Overview  Abstract Classes: A Definition.  Declaring Abstract Classes.  Abstract Methods: A.
Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.
Defining Classes and Methods Chapter 4.1. Key Features of Objects An object has identity (it acts as a single whole). An object has state (it has various.
Introduction To OOP 1.0 Fundamentals Of Java Programming Language 2.0 Exception Handling 3.0 Classes, Inheritance And Polymorphism
Classes and Class Members Chapter 3. 3 Public Interface Contract between class and its clients to fulfill certain responsibilities The client is an object.
Object Oriented Programming Concepts OOP – reasoning about a program as a set of objects rather than as a set of actions Object – a programming entity.
Methods CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Two Parts of Every ADT An abstract data type (ADT)  is a type for encapsulating related data  is abstract in the sense that it hides distracting implementation.
Object Based Programming Chapter 8. 2 In This Chapter We will learn about classes Garbage Collection Data Abstraction and encapsulation.
CS1201: Programming Language 2 Classes and objects By: Nouf Aljaffan Edited by : Nouf Almunyif.
JAVA Classes Review. Definitions Class – a description of the attributes and behavior of a set of computational objects Constructor – a method that is.
Designing a Card Game Solitaire--Thirteens. Game.
BallWorld.java A structured walkthrough. Key Features: 2 classes are created Execution is done through the procedure called “main” which are decleared.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
Lec 14 Writing an Instantiable Class III. Agenda Review of Instantiable Classes Scope of variables Using this to override scope issues Lab: Creating a.
Copyright © 2002 W. A. Tucker1 Chapter 10 Lecture Notes Bill Tucker Austin Community College COSC 1315.
© 2007 Lawrenceville Press Slide 1 Chapter 8 Objects  A variable of a data type that is a class. Also called an instance of a class.  Stores data  Can.
CSE 219 Computer Science III UML. UML Diagrams UML - Unified Modeling Language UML diagrams are used to design object-oriented software systems –represent.
Page 4.1 – Autumn 2010Steffen Vissing Andersen SDJ I1, Autumn 2010 Agenda – Session 4 – 7. September 2009 Java fundamentals, checkpoint from chapter 2.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Schoolwires Calendar App. Calendar Overview Calendar app uses the same color scheme and fonts as the rest of the IRHS site.
Classes and Objects - Part I. What is an Object? An Object has two primary components: state – properties of the object behavior – operations the object.
Working Drawings Stephen W. Crown Ph.D.. Working Drawings A final set of drawings providing all the details and information needed to manufacture and.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Basic Class Structure. Class vs. Object class - a template for building an object –defines the instance data that the object will hold –defines instance.
A structured walkthrough
public class ParkApp extends AndroidApp
Classes C++ representation of an object
Chapter 5 Classes.
Review Session.
Classes A class is a blueprint of an object
Class Variables We’ve seen how to add extra subroutines into our programs Can be accessed from within one another We can also add variables that are “global”
More About Objects and Methods CS140: Introduction to Computing 1 Savitch Chapter 6 10/16/13.
Classes In C#.
Can perform actions and provide communication
Object Based Programming
Overloading and Constructors
Critter exercise: Snake
Can perform actions and provide communication
Introduction to Game Development
A programming problem Given a file of cities' (x, y) coordinates, which begins with the number of cities: Write.
The Object-Oriented Thought Process Chapter 04
Can perform actions and provide communication
Class Examples.
Operator Overloading.
Building Java Programs
Class Everything if Java is in a class. The class has a constructor that creates the object. public class ClassName private Field data (instance variables)
C++ Programming ㅎㅎ String OOP Class Constructor & Destructor.
Pro.3.12.
Object oriented programming (OOP) Lecture No. 7
Working Drawings & Layers
NAME 436.
Classes C++ representation of an object
Dr. R Z Khan Handout-3 Classes
Encapsulation.

Object Oriented Programming
Day 11 The Last Week!.
Introduction to Computer Science and Object-Oriented Programming
Presentation transcript:

Object-Oriented Programming color size getColor drift draw x, y

What is a Balloon?

What is a Balloon? It Depends...

What is a Balloon? It Depends... Is it for a game app? Is it for bookstore inventory app?

What is a Balloon? It Depends... Is it for a game app? If so, a balloon has: color size position on screen

What is a Balloon? It Depends... Is it for a game app? If so, a balloon has: color size position on screen Is it for bookstore inventory app? If so, a balloon has: price manufacturer shelf number

Description of a Balloon: done public class Balloon { }

Description of a Balloon: (1) balloon’s features are: color size position on screen done public class Balloon { }

Description of a Balloon: (1) balloon’s features are: color size position on screen done public class Balloon { // data members String color; double size; double x, y; }

Description of a Balloon: (1) balloon’s features are: color size position on screen (3) balloon’s behaviors are: report its features drift draw itself done public class Balloon { // data members String color; double size; double x, y; }

Description of a Balloon: (1) balloon’s features are: color size position on screen (3) balloon’s behaviors are: report its features drift draw itself done public class Balloon { // data members String color; double size; double x, y; // methods String getColor() void drift( double dx, ... ) void draw() }

Description of a Balloon: (1) balloon’s features are: color size position on screen (2) balloon’s can be created: by giving values for features (3) balloon’s behaviors are: report its features drift draw itself done public class Balloon { // data members String color; double size; double x, y; // methods String getColor() void drift( double dx, ... ) void draw() }

Description of a Balloon: (1) balloon’s features are: color size position on screen (2) balloon’s can be created: by giving values for features (3) balloon’s behaviors are: report its features drift draw itself done public class Balloon { // data members String color; double size; double x, y; // constructor(s) Balloon( String c, ..., ...) // methods String getColor() void drift( double dx, ... ) void draw() }

public class Balloon { // data members private String color; private double size; private double x, y; // constructor(s) public Balloon( String c, ..., ...) // methods public String getColor() public void drift( double dx, ... ) public void draw() }

public Balloon( String c, ..., ...) // methods public class Balloon { // data members private String color; private double size; private double x, y; // constructor(s) public Balloon( String c, ..., ...) // methods public String getColor() public void drift( double dx, ... ) public void draw() } private means hidden public means available

You – Designer of balloon public class Balloon { // data members private String color; private double size; private double x, y; // constructor(s) public Balloon( String c, ..., ...) // methods public String getColor() public void drift( double dx, ... ) public void draw() } You – Designer of balloon know everything about the balloon

Balloon balloon = new Balloon( ... ); public class ParkApp { Balloon balloon = new Balloon( ... ); } .getColor() .drift() .draw() You – User of balloon (in other class) know only public details about balloon