Changes between Version 23 and Version 24 of ControlSystems/SoftwareTeam/Training/GettingStarted/JavaExercises
- Timestamp:
- Dec 2, 2016, 9:41:13 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ControlSystems/SoftwareTeam/Training/GettingStarted/JavaExercises
v23 v24 96 96 * `Cat` and `Dog` start with a default `State` of `WILD` 97 97 * It is possible to `setState` of `Cat` 98 * `Dog` can be `tame`, which makes them more tamed (`WILD` -> `PARTIALLY_TAMED`, `PARTIALLY_TAMED` -> `TAMED`, `TAMED` -> `TAMED`)98 * You can `tame` a `Dog`, which makes them more tamed (`WILD` -> `PARTIALLY_TAMED`, `PARTIALLY_TAMED` -> `TAMED`, `TAMED` -> `TAMED`) 99 99 100 === Step 5: Static 100 === Step 5: Static Variables and Methods 101 101 * `Animal` has a `static int` called `population`, which starts at `0` and increases by `1` every time an animal is created 102 102 * `Animal` has a `static getPopulation` method which returns the total number of animals created … … 106 106 * Create an `interface` called `Building` 107 107 * A building must be able to `collapse` 108 * A building must be able to `store` an object108 * A building must be able to `store` an `Object`, which `return` `true` if it was successful and `false` otherwise. 109 109 110 110 === Step 7: Lists, Generics … … 113 113 * Research `Java Generics` to find out how to create a `List` of `Animal`, and to find out what generics do 114 114 * Use either an `ArrayList` or `LinkedList`, but keep the type generalized as `List` 115 * When a `Farm` `store` an `Object`, it `add` the object to the end of the `List Animal` and `return true` if the object is an `Animal`. Otherwise, it does nothing and `return false`. 115 116 * A `Farm` has an `address` 116 117 * A `Farm` has a `Color` that can be `RED`, `BROWN`, `WHITE`, `BLUE`, or `GREEN`