Dale Roberts Object Oriented Programming using Java - OOD to OOP: ATM Case Study Dale Roberts, Lecturer Computer Science, IUPUI

Slides:



Advertisements
Similar presentations
 Pearson Education, Inc. All rights reserved static Class Members static fields – Also known as class variables – Represents class-wide.
Advertisements

Dale Roberts Introduction to Java - First Program Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and.
Dale Roberts Object Oriented Programming using Java - Inheritance Overview Dale Roberts, Lecturer Computer Science, IUPUI
Dale Roberts Object Oriented Programming using Java - Inheritance Constructors Dale Roberts, Lecturer Computer Science, IUPUI
Dale Roberts GUI Programming using Java - Mouse Events Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
 2008 Pearson Education, Inc. All rights reserved (Optional) Software Engineering Case Study: Starting to Program the Classes of the ATM System.
1 Objects and Classes Introduction to Classes Object Variables and Object References Instantiating Objects Using Methods in Objects Reading for this Lecture:
Class template Describing a generic class Instantiating classes that are type- specific version of this generic class Also are called parameterized types.
 2006 Pearson Education, Inc. All rights reserved Classes and Objects: A Deeper Look.
Dale Roberts Object Oriented Programming using Java - Class Constructors Dale Roberts, Lecturer Computer Science, IUPUI Department.
Object Oriented Programming using Java - Polymorphism
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
1.  A method describes the internal mechanisms that actually perform its tasks  A class is used to house (among other things) a method ◦ A class that.
Dale Roberts Procedural Programming using Java Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and.
Dale Roberts Object Oriented Programming using Java - Packages Dale Roberts, Lecturer Computer Science, IUPUI Department.
Object-Oriented Programming - Classes, Objects Methods, Strings 1 -Based on slides from Deitel & Associates, Inc. - Revised by T. A. Yang.
(C) 2010 Pearson Education, Inc. All rights reserved. Java How to Program, 8/e.
Dale Roberts Introduction to Java - Access Specifiers Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
ATM Case Study Chapter 1-10 Optional Sections
Object-Oriented Programming (OOP). Implementing an OOD in Java Each class is stored in a separate file. All files must be stored in the same package.
Dale Roberts Program Control using Java - Boolean Expressions Dale Roberts, Lecturer Computer Science, IUPUI Department of.
Dale Roberts Object Oriented Programming using Java - Enumerations Dale Roberts, Lecturer Computer Science, IUPUI Department.
Dale Roberts 1 Classes Constructors & Destructors Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer.
Dale Roberts GUI Programming using Java - Event Handling Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Dale Roberts GUI Programming using Java - Introduction Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Dale Roberts Program Control using Java - Selection Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Dale Roberts GUI Programming using Java - GUI Components Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Reformatted slides from the textbook, C++ How to Program, 6/e Pearson Education, Inc. All rights reserved Chapter 3. [Lecture 02] Introduction to.
Java™ How to Program, 10/e © Copyright by Pearson Education, Inc. All Rights Reserved.
CS442: ADVANCED PROGRAMMING USING JAVA Lab 6: Classes and objects Computer Science Department.
Dale Roberts Program Control using Java - Repetition Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
Dale Roberts Object Oriented Programming using Java - Introduction Dale Roberts, Lecturer Computer Science, IUPUI Department.
Chapter 13 ATM Case Study Part 2: Implementing an Object-Oriented Design Java How to Program, 8/e (C) 2010 Pearson Education, Inc. All rights reserved.
Dale Roberts Object Oriented Programming using Java - Final and Static Keywords Dale Roberts, Lecturer Computer Science, IUPUI
Chapter 3 (B) 3.5 – 3.7.  Variables declared in a function definition’s body are known as local variables and can be used only from the line of their.
AP Computer Science A – Healdsburg High School 1 Unit 9 - Why Use Classes - Anatomy of a Class.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
 2005 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
 2005 Pearson Education, Inc. All rights reserved. 1 Classes and Objects: A Deeper Look.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
Dale Roberts Introduction to Java - Input, Program Control and Instantiation Dale Roberts, Lecturer Computer Science, IUPUI
Dale Roberts Object Oriented Programming using Java - Getters and Setters Dale Roberts, Lecturer Computer Science, IUPUI
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
 2005 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The Unified Modeling Language
Dale Roberts GUI Programming using Java - Windowing Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
GUI Programming using Java - Event Handling
Object Oriented Programming using Java - Composition
Classes and Objects: A Deeper Look
Classes and Objects: A Deeper Look
Unified Modeling Language (UML)
GUI Programming using Java - Key Events
Objects as a programming concept
Object Oriented Programming using Java - Class Instance Variables
Variable Declarations, Data types, Expressions
Variable Declarations, Data types, Expressions
CompSci 230 Software Construction
Chapter 13 ATM Case Study Part 2: Implementing an Object-Oriented Design Java How to Program, 8/e (C) 2010 Pearson Education, Inc. All rights reserved.
Classes Access Specifiers
Program Control using Java - Theory
Chapter 3 Introduction to Classes, Objects Methods and Strings
GUI Programming using Java - Mouse Events
Pointers Call-by-Reference CSCI 230
Object Oriented Programming in java
Classes Introduction CSCI 240
Abstract Data Types Stacks CSCI 240
Presentation transcript:

Dale Roberts Object Oriented Programming using Java - OOD to OOP: ATM Case Study Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and Information Science, School of Science, IUPUI

Dale Roberts 2 Starting to Program the Classes of the ATM System Visibility Attributes normally should be private, methods invoked by clients should be public Visibility markers in UML A plus sign (+) indicates public visibility A minus sign (-) indicates private visibility Navigability Navigability arrows indicate in which direction an association can be traversed Bidirectional navigability Associations with navigability arrows at both ends or no navigability arrows at all can be traversed in either direction

Dale Roberts 3 Fig | Class diagram with visibility markers.

Dale Roberts 4 Fig | Class diagram with navigability arrows.

Dale Roberts 5 Starting to Program the Classes of the ATM System (Cont.) Implementing the ATM system from its UML design (for each class) Declare a public class with the name in the first compartment and an empty no-argument constructor Declare instance variables based on attributes in the second compartment Declare references to other objects based on associations described in the class diagram Declare the shells of the methods based on the operations in the third compartment Use the return type void if no return type has been specified

Dale Roberts 6 Fig | Class diagram with visibility markers.

Dale Roberts 7Outline withdrawal.ja va Class for Withdrawal Empty no-argument constructor

Dale Roberts 8 Fig | Class diagram with visibility markers.

Dale Roberts 9Outline withdrawal.ja va Declare instance variables

Dale Roberts 10 Fig | Class diagram with navigability arrows.

Dale Roberts 11Outline withdrawal.ja va Declare references to other objects

Dale Roberts 12 Fig | Class diagram with visibility markers.

Dale Roberts 13Outline withdrawal.ja va Declare shell of a method with return type void

Dale Roberts Acknowledgements Deitel, Java How to Program