Docsity

Object Oriented Programming Thinking in objects, Study Guides, Projects, Research of Object Oriented Programming

Partial preview of the text

Download Object Oriented Programming Thinking in objects and more Study Guides, Projects, Research Object Oriented Programming in PDF only on Docsity!

Lecture 4:Thinking in Objects

Kurui Daniel

Case Study: Duke’s Choice

6/11/2018 Object Oriented Programming

Possible Objects

in the Duke’s Choice Case Study

Identifying Object Attributes and

Operations

– Attributes are data, such as:

  • ID
  • Order object

– Operations are actions, such as:

  • Delete item
  • Change ID

Possible Attributes and Operations for

Objects

in the Duke’s Choice Case Study

**order ID Order data *Shirt(s) total price *Form of payment CSR status calculate order ID calculate the total price add shirt to order remove shirt from order submit the order shirt ID Shirt price description size color code calculate shirt ID display shirt information customer ID Customer name address phone number email address Order assign a customer ID

Case-Study Solution: Classes

Class Order^ Shirt^ Customer^ Form of Payment Catalog CSR

Case-Study Solution: Attributes

Class Form of Payment Catalog CSR Attributes customer ID name address phone number email address *Order *Shirt(s) name extension

Case-Study Solution: Behaviors

Class Order^ Shirt^ Customer Attributes order ID date *Shirt(s) total price *Form of payment *CSR status shirt ID price description size color code customer ID name address phone number email address *Order Behaviors calculate order ID calculate total price add shirt to order remove shirt from order Submit the order calculate shirt ID display shirt information assign a customer ID

Class and Resulting Objects

Shirt shirt ID price description size color Code R=Red, B=Blue, G=Green calculateShirt ID ( ) displayShirtInformation ( )

Shirt

Class

Shirt Objects

Modeling Classes

• Example:

Shirt

shirtID

price

description

size

colorCode R=Red, B=Blue, G=Green

calculateShirtID()

displayInformation()