Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSE205 Lecture 05

CSE205 Lecture 05

Object-Oriented Programming and Data Structures
Inheritance I
(202202)

Javier Gonzalez-Sanchez
PRO

September 15, 2021
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. jgs
    CSE 205
    Object-Oriented Programming and
    Data Structures
    Lecture 05: Programming with Java IV
    Dr. Javier Gonzalez-Sanchez
    [email protected]
    javiergs.engineering.asu.edu | javiergs.com
    PERALTA 230U
    Office Hours: By appointment

    View Slide

  2. jgs
    Previously…

    View Slide

  3. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 4
    jgs
    Lecture 31
    2D Array
    § Declaration
    § Initializer List
    § Add values
    § Print values
    § Etc…
    0
    1
    2
    3
    4
    5
    0 0 0
    0 0 0
    0 0 0
    0 0 0
    0 0 0
    0 0 0
    0 1 2

    View Slide

  4. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 5
    jgs
    Lecture 32
    3D Arrays (Multidimensional)
    § Declaration
    § Initializer List
    § Add values
    § Print values
    § Etc…
    12 24
    8 16
    4 8
    9 18
    6 12
    3 6
    6 12
    4 8
    2 4
    3 6
    2 4
    1 2

    View Slide

  5. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 6
    jgs
    Lecture 33
    Recursion
    § How does it work
    § Understand factorial. Fibonacci, Searching, etc.
    § What about print numbers n to m?
    § What about add numbers 0 to n?

    View Slide

  6. jgs
    UML Diagrams

    View Slide

  7. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 8
    jgs
    Blueprint

    View Slide

  8. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 9
    jgs
    UML Diagrams

    View Slide

  9. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 10
    jgs
    UML Class diagram
    § The Unified Modeling Language
    Class diagrams show the classes in a system
    § modifiers
    § Attributes
    § methods
    And the relationships between these classes:
    § Association / Dependency (calling methods)
    § Aggregation / Composition (attributes)
    § Generalization / Specialization / Realization (inheritance)

    View Slide

  10. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 11
    jgs
    Class Name
    Attributes variableName:type = initial value
    Methods
    methodName(parameterType):return type
    UML Class diagram

    View Slide

  11. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 12
    jgs
    Diagrams (UML)
    # name:String
    + Vehicle()
    + Car()
    +
    -
    #

    View Slide

  12. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 13
    jgs
    Object Oriented Relationships
    Directed
    Association
    Aggregation Generalization Realization

    View Slide

  13. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 14
    jgs
    Questions

    View Slide

  14. jgs
    CSE 205 Object-Oriented Programming and Data Structures
    Javier Gonzalez-Sanchez, Ph.D.
    [email protected]
    Spring 2022
    Copyright. These slides can only be used as study material for the class CSE205 at Arizona State University.
    They cannot be distributed or used for another purpose.

    View Slide