Presentation is loading. Please wait.

Presentation is loading. Please wait.

Basic Object-Oriented Concepts

Similar presentations


Presentation on theme: "Basic Object-Oriented Concepts"— Presentation transcript:

1 Basic Object-Oriented Concepts
22-Apr-17

2 Object Oriented Programming
Object-oriented programming (OOP) is a programming language model organized around objects Objects have a state or properties (information about the object stored in variables) size, height, position, balance Objects have a behavior or actions that it performs. Methods. move ____ turn____ Programming languages have predefined methods for each class.

3 Class <CAR> creates cars
Everything in Java is in a class. Class called Car The class creates objects The class represents a template for creating objects of that class.

4 Class Car creates car objects: Share same attributes but they store different values.
<7_series_BMW> Object <VW_Beetle> Object <Ford_Mustang> Share same attritubes: They have a ……. color – model# name doors You would store this in variables because it would be different for each object.

5 Example: A “Rabbit” object
You could (in a game, for example) create an object representing a rabbit It would have data which is stored in variables. How hungry it is? = hungry = true; How frightened it is? frightened = false; Where it is? location = 0; What is its name? name = “Rabbit”; And methods: things it can do eat, hide, run, dig

6 Class <CAR> startEngine checkEngine fillTank getAmountOfGas
Method of a Class Class <CAR> Every class has predefined methods for the object created. Methods allow the object created to perform an action startEngine checkEngine fillTank getAmountOfGas

7 Control flow of a program
Three types of control flow that are used to execute a program Sequentially - all code will run sequentially Conditionals (if statements) Loops (repeats)

8 Introduction to programming thru SNAP
Cloud storage if you create user name The program interface Click on object and script area to build your code


Download ppt "Basic Object-Oriented Concepts"

Similar presentations


Ads by Google