Object Interaction - PowerPoint PPT Presentation

About This Presentation
Title:

Object Interaction

Description:

BankAccount marsha. Object Interaction. 5: Object Interaction. Slide 3. Object Interaction ... BankAccount marsha. deposit( 'john', 200 ) deposit( 200 ) ... – PowerPoint PPT presentation

Number of Views:146
Avg rating:3.0/5.0
Slides: 8
Provided by: luisf55
Category:

less

Transcript and Presenter's Notes

Title: Object Interaction


1
Object Interaction
  • Notes Supplement
  • CS 1054 Introduction to Programming in Java
  • Spring 2008

2
Bank Example Revisited
1000
Bank
BankAccount john
BankAccount marsha
2000
3
Object Interaction
Bank
deposit( 200 )
BankAccount john
1000
deposit( john, 200 )
BankAccount marsha
2000
Calling deposit on the Bank object causes deposit
to be called on a BankAccount object
4
Array/ArrayList Version
Bank
BankAccount accounts
deposit( 200 )
deposit( 222, 200 )

Calling deposit on the Bank object causes deposit
to be called on a BankAccount object
5
Lab 9 ReportCardupdateGradeRecord( )
ReportCard
GradeRecord grades
updateGradeRecord( English, 85 )

changeGrade(85)
--- 85
Calling updateGradeRecord on the ReportCard
objectcauses changeGrade to be called on a
GradeRecord object
6
Lab 9 ReportCardgetAverage( )
getGrade()
ReportCard
GradeRecord grades
getGrade()
getAverage()

getGrade()
Calling getAverage on the ReportCard object
causesgetGrade to be called on each GradeRecord
object
7
Project 4 Grocery and Item
Grocery
Item items

100.00
cash
Write a Comment
User Comments (0)
About PowerShow.com