AP Computer Science A – Healdsburg High School 1 Unit 3 - Classes and Objects - Example.

Slides:



Advertisements
Similar presentations
Object-Oriented Programming Basics Prof. Ankur Teredesai, Computer Science Department, RIT.
Advertisements

When is Orientated Programming NOT? Mike Fitzpatrick.
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
Chapter 4&5 Defining Classes Copyright © 2010 Pearson Addison-Wesley. All rights reserved.
Introduction to Object Oriented Programming Java.
Introduction to Object-Oriented Programming CS 21a: Introduction to Computing I First Semester,
Introduction To System Analysis and Design
Objects and Classes First Programming Concepts. 14/10/2004Lecture 1a: Introduction 2 Fundamental Concepts object class method parameter data type.
What is an object? Your dog, your desk, your television set, your bicycle. Real-world objects share two characteristics: They all have state and behavior;
Basic OOP Concepts and Terms
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Java Objects and Classes. 3-2 Object Oriented Programming  An OO program models the application as a world of interacting objects.  A typical Java program.
1 INTRODUCTION TO OOP Objective: Know the difference between functional programming and OOP Know basic terminology in OOP Know the importance of OOP Know.
MIT AITI 2003 Lecture 7 Class and Object - Part I.
UML Sequence Diagrams Michael L. Collard, Ph.D. Department of Computer Science Kent State University.
Lecture 1 Introduction to Java MIT- AITI 2004 What is a Computer Program? For a computer to be able to do anything (multiply, play a song, run a word.
Object Oriented Software Development
Introduction to Object Oriented Design. Topics Designing Your Own Classes Attributes and Behaviors Class Diagrams.
Programming Languages and Paradigms Object-Oriented Programming.
Object Orientation An Object oriented approach views systems and programs as a collection of interacting objects. An object is a thing in a computer system.
Introduction to Object-Oriented Programming
Object Oriented Design: Identifying Objects
Recap (önemli noktaları yinelemek) from last week Paradigm Kay’s Description Intro to Objects Messages / Interconnections Information Hiding Classes Inheritance.
Lecture 1 Introduction to Java MIT-AITI Ethiopia 2004.
Introduction To System Analysis and Design
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
Spring 2008 Mark Fontenot CSE 1341 Principles of Computer Science I Note Set 2.
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
Computer Science II 810:062 Section 01. How is CS I different from CS II? When you teach Java there are a series of decisions that have to be made…
Chapter 7 Objects and Classes 1 Fall 2012 CS2302: Programming Principles.
Objects and Classes Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Copyright © 2006 by Maria Litvin, Gary.
1 Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill Chapter 2: Object Basics Object-Oriented Systems Development Using the Unified Modeling.
Basic OOP Concepts and Terms. In this class, we will cover: Objects and examples of different object types Classes and how they relate to objects Object.
The Unified Modeling Language Part II Omar Meqdadi SE 2730 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Chapter 10 Defining Classes. The Internal Structure of Classes and Objects Object – collection of data and operations, in which the data can be accessed.
AP Computer Science A – Healdsburg High School 1 Unit 3 - Objects and Classes Lab: First Steps - Example.
Object-Oriented Programming •Object-Oriented Programming (OOP) allows you to create your program based upon modeling objects.  Your program’s properties.
Inheritance A Review of Objects, Classes, and Subclasses.
Overview The Basics – Python classes and objects Procedural vs OO Programming Entity modelling Operations / methods Program flow OOP Concepts and user-defined.
AP Computer Science A – Healdsburg High School 1 Unit 9 - Why Use Classes - Anatomy of a Class.
Rina System development with Java Instructors: Rina Zviel-Girshin Lecture 3.
Using Objects 1 of 22 Computer Programming Object Classes.
AP Computer Science A – Healdsburg High School 1 static Keyword in Java - Static variables - Static methods.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Objective You will be able to define the basic concepts of object-oriented programming with emphasis on objects and classes by taking notes, seeing examples,
Objects and Classes Start on Slide 30 for day 2 Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Much of.
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
AP Computer Science A – Healdsburg High School 1 Unit 2 - Object-Oriented Programming - Example.
1 Class and Object Lecture 7. 2 Classes Classes are constructs that define objects of the same type. A Java class uses instance variables to define data.
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
Object Oriented Programming Object and Classes Lecture 3 MBY.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
Today Review passing by reference and pointers. null pointers. What is an Object? Winter 2016CMPE212 - Prof. McLeod1.
Chapter 1 Object Orientation: Objects and Classes.
Objects as a programming concept
Object-Oriented Programming Basics
Sections Basic Concepts of Programming
Objects as a programming concept
Object Oriented Programming
Object Oriented Concepts -I
Nat 4/5 Computing Science Operating Systems
Basic OOP Concepts and Terms
CSC 111 Exam 3 Review Fall 2005.
Object-Oriented Programming (OOPs)
Introduction to Computer Science and Object-Oriented Programming
Presentation transcript:

AP Computer Science A – Healdsburg High School 1 Unit 3 - Classes and Objects - Example

AP Computer Science A – Healdsburg High School 2 OOP An OO program models the application as a world of interacting objects. An object can create other objects. An object can call another object’s (and its own) methods (that is, “send messages”). An object has data fields, which hold values that can change while the program is running.

AP Computer Science A – Healdsburg High School 3 Objects Can model real-world objects Can represent GUI (Graphical User Interface) components Can represent software entities (events, files, images, etc.) Can represent abstract concepts (for example, rules of a game, a particular type of dance, etc.)

AP Computer Science A – Healdsburg High School 4 Classes and Objects A class is a piece of the program’s source code that describes a particular type of objects. OO programmers write class definitions. An object is called an instance of a class. A program can create and use more than one object (instance) of the same class.

AP Computer Science A – Healdsburg High School 5 Class Object A blueprint for objects of a particular type Defines the structure (number, types) of the attributes Defines available behaviors of its objects Attributes Behaviors

AP Computer Science A – Healdsburg High School 6 Class: Car Object: a car Attributes: String model Color color int numPassengers double amountOfGas Behaviors: Add/remove a passenger Get the tank filled Report when out of gas Attributes: model = "Mustang" color = Color.YELLOW numPassengers = 0 amountOfGas = 16.5 Behaviors:

AP Computer Science A – Healdsburg High School 7 Class vs. Object A piece of the program’s source code Written by a programmer An entity in a running program Created when the program is running (by the main method or a constructor or another method)

AP Computer Science A – Healdsburg High School 8 Class vs. Object Specifies the structure (the number and types) of its objects’ attributes — the same for all of its objects Specifies the possible behaviors of its objects Holds specific values of attributes; these can change while the program is running Behaves appropriately when called upon

AP Computer Science A – Healdsburg High School Introducing The Vic Class A programmable machine that stores CD’s and moves them around with operator commands.

AP Computer Science A – Healdsburg High School 10 Ex. Write an application program that creates a Vic object and then swaps the CD in its third slot with the CD in its second slot. Assume it has CDs in both slots.