Object-Oriented Programming: Defining Classes and Solving Basic Problems, Slides of Object Oriented Programming

An introduction to object-oriented programming (oop) through the definition of classes and the resolution of simple problems, such as adding and finding the maximum of two numbers. It also includes examples and exercises.

Typology: Slides

2011/2012

Uploaded on 07/17/2012

pankarithi
pankarithi 🇮🇳

4.6

(5)

59 documents

1 / 20

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Programming OOP Class Examples Example 1 Example 2 Exercises
Outline of the Lecture 04
1Programming
2OOP
3Class
4Examples
5Example 1
6Example 2
7
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14

Partial preview of the text

Download Object-Oriented Programming: Defining Classes and Solving Basic Problems and more Slides Object Oriented Programming in PDF only on Docsity!

Outline of the Lecture 04

1 Programming

2 OOP

3 Class

4 Examples

5 Example 1

6 Example 2

Programming Paradigms

A Programming Paradigm is a fundamental style of computer

programming.

In Functional Programming a program can be thought of as a

sequence of stateless function evaluations.

In Object Oriented Programming, programmers can think of a

program as a collection of interacting objects.

Process Oriented Programming allows programmers to think

about applications as sets of concurrent processes acting upon

logically shared data structures.

Object Oriented Programming

Object Oriented Programming ( OOP ) is a programming

paradigm that uses "objects" – data structures consisting of data

fields and methods together with their interactions – to design

applications and computer programs.

Programming techniques may include features such as data

abstraction, encapsulation, modularity, polymorphism, and

inheritance.

Object Oriented Programming

Multiple Independent Intelligent Objects

Message Passing, Local State & Inheritance

Define Class, Instantiate, Ask

Examples

Adding two Numbers

Finding the Maximum of Two Numbers

Adding two Numbers

Class TwoNums

Adding two Numbers

Class TwoNums

Instantiate MyTwoNums of Type TwoNums 1 & 2

Ask MyTwoNums, Sum of the Two

The Answer is 3

Adding two Numbers

Class TwoNums

Instantiate MyTwoNums of Type TwoNums 1 & 2

Ask MyTwoNums, Sum of the Two

The Answer is 3

Ask MyTwoNums, Subtract first from the second

The Answer is 1

Adding two Numbers

Class TwoNums

Instantiate MyTwoNums of Type TwoNums 1 & 2

Ask MyTwoNums, Sum of the Two

The Answer is 3

Ask MyTwoNums, Subtract first from the second

The Answer is 1

Ask MyTwoNums, Subtract second from the first

The Answer is 1

Ask MyTwoNums, Absolute difference between two

The Answer is 1

Finding the Maximum of Two Numbers

Class TwoNums

Finding the Maximum of Two Numbers

Class TwoNums

Instantiate MyTwoNums of Type TwoNums 1 & 2

Ask MyTwoNums, Greater of the Two

The Answer is 2

Finding the Maximum of Two Numbers

Class TwoNums

Instantiate MyTwoNums of Type TwoNums 1 & 2

Ask MyTwoNums, Greater of the Two

The Answer is 2

Ask MyTwoNums, Smaller of the Two

The Answer is 1

Finding the Maximum of Two Numbers

Class TwoNums

Instantiate MyTwoNums of Type TwoNums 1 & 2

Ask MyTwoNums, Greater of the Two

The Answer is 2

Ask MyTwoNums, Smaller of the Two

The Answer is 1

Ask MyTwoNums, Which one is Smaller

The Answer is "The First One"

Ask MyTwoNums, Which one is Greater

The Answer is "The Second One"

Exercises

Printing Numbers from 1 to 10 without a Loop

Printing Numbers from 10 to 1 with a Loop

Finding GCD of Two Numbers

Finding LCM of Two Numbers

Summing a Sequence

Summing a Series

Think about Necessary Classes in this Class Room.