Object-Oriented Programming Design with Greenfoot 01

download Object-Oriented Programming Design with Greenfoot 01

If you can't read please download the document

Transcript of Object-Oriented Programming Design with Greenfoot 01

1


[email protected]/6/15

CC Attribution-ShareAlike 3.0 Unported

Object-Oriented Programming (OOP)

Procedural ProgrammingProceduresFlow

Functions

Subroutines

Pokkunuri, B. P. (1989, November). Object oriented programming. ACM SIGPLAN Notices, 24(11), 96-101. doi:10.1145/71605.71612

12332

1

123123

solitaireimages

Solitaire Flash

(Class)(Object)

52

classclassclass

solitaire-start

import greenfoot.*; // WorldActorGreenfootImageGreenfootSoundGreenfootMouseInfoimport java.util.ArrayList;

/** * * * @author * @version 2012/6/15 */public class Table extends World{ /** */ public UnflippedPile unflippedPile = null; /** */ public FlippedPile flippedPile = null; /** */ public ArrayList workingPiles = new ArrayList(); /** */ public ArrayList resultPiles = new ArrayList();

public Table() { // 600x4001x1 super(600, 400, 1); unflippedPile = new UnflippedPile(); // addObject(unflippedPile, 48, 60); flippedPile = new FlippedPile(); // addObject(flippedPile, 132, 60); workingPiles = new ArrayList(); // for (int i = 1; i