Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 13 Object-Oriented Programming I am surprised.

Slides:



Advertisements
Similar presentations
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 13 Object-Oriented Programming I am surprised.
Advertisements

Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 11 Memory Management C makes it easy to shoot.
INTERFACES IN JAVA 1.Java Does not support Multiple Inheritance directly. Multiple inheritance can be achieved in java by the use of interfaces. 2.We need.
Algebra 1 Glencoe McGraw-Hill JoAnn Evans
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 14 Functional Programming It is better to.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 2 Syntax A language that is simple to parse.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 4 Defining Your Own Classes.
IntroductionIntroduction  Computer program: an ordered sequence of statements whose objective is to accomplish a task.  Programming: process of planning.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 5 Types Types are the leaven of computer programming;
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 4 Defining Your Own Classes.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 2 Syntax A language that is simple to parse.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 12 Imperative Programming I really hate this.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 12 Imperative Programming I really hate this.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 10 Function Implementation In theory, there.
Principles of Object-Oriented Software Development The language Java.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 13 Object-Oriented Programming I am surprised.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 10 Function Implementation In theory, there.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 13 Object-Oriented Programming I am surprised.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 4 Defining Your Own Classes.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 6 Type Systems I was eventually persuaded.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 2 Syntax A language that is simple to parse.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 7 Semantics Ismael: “Surely all this is not.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 5 Types Types are the leaven of computer programming;
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 4 Defining Your Own Classes.
Algebra 2: Section 6.1 Properties of Exponents. Product of Powers –(when multiplying like bases, add exponents) Power of a Power –(when taking an exponent.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 3 Lexical and Syntactic Analysis Syntactic.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. C H A P T E R S E V E N Object-Oriented Programming.
The Basic of Algebra BY Nathaniel Jefferson. The Number Line  |  0 Always start at zero.
Order of Operations Chapter 1 Section 2 Part 1 and Part 2.
CSC 212 Object-Oriented Programming and Java Part 1.
Exponents and Polynomials
Copyright (c) 2010 Pearson Education, Inc. Laws of Exponents.
C Derived Languages C is the base upon which many build C++ conventions also influence others *SmallTalk is where most OOP comes Java and Javascript have.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Mark Dugopolski Elementary Algebra Edition 3 Chapter 6 Rational Expressions Copyright © 2000 by the McGraw-Hill Companies, Inc.
Copyright © 2012, 2009, 2005, 2002 Pearson Education, Inc. Chapter 2 Fractions.
Sullivan Algebra and Trigonometry: Section R.7 Rational Expressions
Divide. Evaluate power – 3 = – 3 EXAMPLE – 3 = 3 2 – – 3 = 6 – 3 Multiply. Evaluate expressions Multiply and divide from.
Exponent Rules Algebra 2/Trig. Parts When a number, variable, or expression is raised to a power, the number, variable, or expression is called the base.
1-2 Order of Operations and Evaluating Expressions.
Introduction to Java Chapter 7 - Classes & Object-oriented Programming1 Chapter 7 Classes and Object-Oriented Programming.
Chapter 7: Class Inheritance F Superclasses and Subclasses F Keywords: super and this F Overriding methods F The Object Class F Modifiers: protected, final.
< < < > < > <
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 2 Syntax A language that is simple to parse.
Copyright © 2014, 2010, and 2006 Pearson Education, Inc. Chapter 1 Introduction to Algebraic Expressions.
Copyright © 2014, 2010, and 2006 Pearson Education, Inc. Chapter 1 Introduction to Algebraic Expressions.
Object orientation and Packaging in Java Object Orientation and Packaging Introduction: After completing this chapter, you will be able to identify.
Notes 2.1 Order of Operations PEMDAS If an expression has only numbers and symbols, it is a numerical expression. If it has a variable it is a variable.
Simplify Radical Expressions Using Properties of Radicals.
C++ General Characteristics: - Mixed typing system - Constructors and destructors - Elaborate access controls to class entities.
Algebra with Whole Numbers Algebraic Notation. Simplify.
Chapter P Prerequisites: Fundamental Concepts of Algebra Copyright © 2014, 2010, 2007 Pearson Education, Inc. 1 P.2 Exponents and Scientific Notation.
1-2 Order of Operations Objective: Use the order of operations to evaluate expressions.
© 2011 Pearson Education, publishing as Addison-Wesley Chapter 1: Computer Systems Presentation slides for Java Software Solutions for AP* Computer Science.
ORDER OF OPERATIONS. 1.Perform any operations with grouping symbols. 2.Simplify powers. 3.Multiply and divide in order from left to right. 4.Add and subtract.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 8 Semantic Interpretation To understand a.
Jeopardy Solving Equations
Rational Expressions and Equations
Chapter 4 Assignment Statement
Algebra 1 Section 2.3 Subtract real numbers
Copyright © 2014, 2010, 2007 Pearson Education, Inc.
Multiplying and Dividing Powers
null, true, and false are also reserved.
Conditional Statements
Chapter 5-1 Exponents.
Exponents & Scientific Notation Test Corrections
You replace it with its simplest name
ALGEBRA what you need to know..
Presentation transcript:

Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 13 Object-Oriented Programming I am surprised that ancient and Modern writers have not attributed greater importance to the laws of inheritance... Alexis de Tocqueville

Copyright © 2006 The McGraw-Hill Companies, Inc. Contents 13.1 Prelude: Abstract Data Types 13.2 The Object Model 13.3 Smalltalk 13.4 Java 13.5 Python

Copyright © 2006 The McGraw-Hill Companies, Inc Java 1.0 released in (or Java 5) in 2004 major language changes: 1.1, 1.5 steady growth in SE libraries mixed language –primitive types: int, double, boolean –objects statically typed single inheritance

Copyright © 2006 The McGraw-Hill Companies, Inc. Direct support for: inner classes visibility modifiers abstract classes interfaces generics run time type identification reflection

Copyright © 2006 The McGraw-Hill Companies, Inc. Example: Symbolic Differentiation Implement symbolic differentiation State rules Simplification separate Use of abstract syntax

Copyright © 2006 The McGraw-Hill Companies, Inc. Symbolic Differentiation Rules Figure 13.19

Copyright © 2006 The McGraw-Hill Companies, Inc. Example d/dx (2*x+1) d/dx (2*x+1) = d/dx (2*x) + d/dx 1 = x * d/dx * d/dx x + 0 = x * * simplified algebraically: 2

Copyright © 2006 The McGraw-Hill Companies, Inc. Abstract Syntax of Expressions Expression = Variable | Value | Binary Variable = String id Value = int value Binary = Add | Subtract | Multiply | Divide Add = Expression left, right Subtract = Expression left, right Multiply = Expression left, right Divide = Expression left, right

Copyright © 2006 The McGraw-Hill Companies, Inc. public abstract class Expression { public abstract Expression diff(Variable x); }

Copyright © 2006 The McGraw-Hill Companies, Inc. class Value extends Expression { private int value; public Value(int v) { value = v; } public Expression diff(Variable x) { return new Value(0); }

Copyright © 2006 The McGraw-Hill Companies, Inc. class Variable extends Expression { private String id; static final private Value zero = new Value(0); static final private Value one = new Value(1); public Variable(String s) { id = s; } public Expression diff(Variable x) { return id.equals(x.id) ? one : zero; }

Copyright © 2006 The McGraw-Hill Companies, Inc. abstract class Binary extends Expression { protected Expression left, right; protected Binary(Expression u, Expression v) { left = u; right = v; }

Copyright © 2006 The McGraw-Hill Companies, Inc. class Add extends Binary { public Add(Expression u, Expression v) { super(u, v); } public Expression diff(Variable x) { return new Add(left.diff(x), right.diff(x)); }