Skip to content

Day 23 / Mar 31 (Thu)

Pair Programming

Pair programming

Zoo Inheritance

  1. Create a command-line application that loads a zoo registry (a file with animal names and their count)
  2. Create a trait Animal that defines def talk, def walk and def numberOfLegs
  3. Create concrete classes for animals, e.g. Lion, Duck, Cat, Dog
  4. Create a sequence of animals and let them talk, walk, and displays numberOfLegs
trait Animal {}
case class Lion(...) extends Animal {}
// ...
val animals = Seq[Animal](...)
animals.foreach { a => ??? }

Working in pairs1:

  1. FIXME

  1. The story, all names, characters, and incidents portrayed in this production are fictitious. No identification with actual persons (living or deceased), places, buildings, and products is intended or should be inferred. (cf. All persons fictitious disclaimer

Back to top