Ice cream model
Download
1 / 12

Ice Cream Model - PowerPoint PPT Presentation


  • 225 Views
  • Updated On :

Ice Cream Model. If( f.equals( “vanilla” ) ){ // do something }else if ( f.equals( “chocolate” ) ){ // do something else } Cream aCream = new Cream(); aCream.setFlavor( “vanilla” );. Cream. - flavor: String - toppings: String - price: float … . + setFlavor( f: String ): void.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Ice Cream Model' - DoraAna


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Ice cream model l.jpg
Ice Cream Model

  • If( f.equals(“vanilla”) ){ // do something}else if ( f.equals(“chocolate”) ){ // do something else}

  • Cream aCream = new Cream();aCream.setFlavor(“vanilla”);

Cream

- flavor: String

- toppings: String

- price: float

+ setFlavor(f: String): void

Let’s not do this. Have your complier work harder!


Slide2 l.jpg

  • If( f.equals(“vanilla”) ){ // do something}else if ( f.equals(“chocolate”) ){ // do something else}

  • Cream aCream = new Cream();aCream.setFlavor(“vanilla”);

Cream

- flavor: String

- toppings: String

- price: float

+ setFlavor(f: String): void

If( f.equals(Flavor.VANILLA) ){// do something

}

else if( f.equals(Flavor.VANILLA) ){// do something else

}

Cream aCream = new Cream();

aCream.setFlavor(Flavor.VANILLA);

Cream

<<enumeration>>

Flavor

- flavor: Flavor

- toppings: String

- price: float

0..*

VANILLACHOCOLATESTRAWBERY

LIME

ORANGE

1

+ setFlavor(f: Flavor): void


Slide3 l.jpg

Cream

<<enumeration>>

Flavor

0..*

1

- flavor: Flavor

- toppings: Topping[]

- price: float

VANILLACHOCOLATESTRAWBERY

LIME

ORANGE

0..*

+ setFlavor(f: Flavor): void

+ setToppings(t: Topping[]): void

<<enumeration>>

Topping

0..*

NUTSEXTRACHOCOLATESTRAWBERRYJEERRY


Slide4 l.jpg

Cream

<<enumeration>>

Flavor

0..*

1

- flavor: Flavor

- toppings: Topping[]

- price: float

VANILLACHOCOLATESTRAWBERY

Class

diagram

+ setFlavor(f: Flavor): void

+ setToppings(t: Topping[]): void

myCream: Cream

vanilla: Flavor

Flavor.VANILLA

Object

diagram

yourCream: Cream

chocolate: Flavor

Flavor.CHOCOLATE

: Cream

strawberry: Flavor

Flavor.STRAWBERY


Now we can make these ones l.jpg
Now, We can Make these Ones.

Cream

<<enumeration>>

Flavor

0..*

1

- flavor: Flavor

- toppings: Topping[]

- price: float

VANILLACHOCOLATESTRAWBERY

LIME

ORANGE

0..*

+ setFlavor(f: Flavor): void

+ setToppings(t: Topping[]): void

<<enumeration>>

Topping

0..*

NUTSEXTRACHOCOLATESTRAWBERRYJEERRY


How about these ones l.jpg
How about these ones?

http://www.graniteschools.org/jr/eisenhower/images/memorie%20pics/world_records/Tallest_Ice_Cream_Cone.jpg


Slide7 l.jpg

up

0..1

Cream

<<enumeration>>

Flavor

0..*

1

- flavor: Flavor

- toppings: Topping[]

- price: float

VANILLACHOCOLATESTRAWBERY

LIME

ORANGE

down

0..*

0..1

+ setFlavor(f: Flavor): void

+ setToppings(t: Topping[]): void

Class

diagram

<<enumeration>>

Topping

0..*

NUTSEXTRACHOCOLATESTRAWBERRYJEERRY

3rdCream: Cream

vanilla: Flavor

up

Flavor.VANILLA

Object

diagram

down

2ndCream : Cream

chocolate: Flavor

up

Flavor.CHOCOLATE

down

1stCream : Cream

strawberry: Flavor



Slide9 l.jpg

1

<<enumeration>>

Flavor

Cream

1

- flavor: Flavor

- toppings: Topping[]

- price: float

VANILLACHOCOLATESTRAWBERY

LIME

ORANGE

0..*

- scoops

0..*

0..*

+ setFlavor(f: Flavor): void

+ setToppings(t: Topping[]): void

<<enumeration>>

Topping

0..*

NUTSEXTRACHOCOLATESTRAWBERRYJEERRY

- cone

1

0..1

Cone

0..*


How about these cases l.jpg
How about these cases?

Cone or cup

Size of cone/cup


Slide11 l.jpg

<<enumeration>>

Flavor

Cream

1

- flavor: Flavor

- toppings: Topping[]

- price: float

VANILLACHOCOLATESTRAWBERY

LIME

ORANGE

0..*

- scoops

0..*

0..*

+ setFlavor(f: Flavor): void

+ setToppings(t: Topping[]): void

<<enumeration>>

Topping

0..*

- scoops

0..*

NUTSEXTRACHOCOLATESTRAWBERRYJEERRY

- cup

0..1

0..1

- cone

0..1

0..*

Cup

Cone

0..*

0..*

<<enumeration>>

Size

SMALLMEDIUM

LARGE

1

- size


Slide12 l.jpg

<<enumeration>>

Flavor

Cream

1

- flavor: Flavor

- toppings: Topping[]

- price: float

VANILLACHOCOLATESTRAWBERY

LIME

ORANGE

0..*

- scoops

0..*

0..*

+ setFlavor(f: Flavor): void

+ setToppings(t: Topping[]): void

<<enumeration>>

Topping

0..*

1

- base

NUTSEXTRACHOCOLATESTRAWBERRYJEERRY

Base (Lower Part)

0..*

- size: Size

- scoops: Cream[]

- price: float

- topping: Topping

- size

1

0..1

<<enumeration>>

Size

SMALLMEDIUM

LARGE

Cup

Cone

0..*


ad