Skip to content

Instantly share code, notes, and snippets.

@wofockham
Last active August 29, 2015 13:56
Show Gist options
  • Save wofockham/1cbb5fb3fcf592a42431 to your computer and use it in GitHub Desktop.
Save wofockham/1cbb5fb3fcf592a42431 to your computer and use it in GitHub Desktop.

#Title: HappiTails

###Objective:

  • Practice creating objects

###Explanation

  • You are the manager at HappiTails animal shelter. You need to manage your shelter by storing and manipulating information about clients and animals.

###Specification: #####Object Specs:

  • Animal:

    • An animal should have a name.
    • An animal should have an age.
    • An animal should have a gender.
    • An animal should have a species.
    • An animal can have multiple toys.
  • Client:

    • A client should have a name.
    • A client should have a number of children.
    • A client should have an age.
    • A client should have a number of pets.
  • You may also want a global $shelter variable in which you can store the animals and clients.

#####Relationships:

  • A client should be able to adopt an animal.
  • A client should be able to put an animal up for adoption.

#####Phase 1

  • Can create animals and clients with Ruby code: Animal.new( ... ), Client.new( ... )

#####Phase 2

  • New animals and clients can be added to the shelter: $shelter['animals'] << Animal.new( ... )

#####Phase 3

  • When creating an animal or client, the user is prompted for information like names, gender etc.

#####Phase 4

  • At start, the user is prompted with a menu of options:
    • display all animals
    • display all clients
    • create an animal
    • create an client
    • facilitate client adopts an animal
    • facilitate client puts an animal up for adoption
  • After selecting from the menu the task the user is prompted through the entire process

#####Bonus: Crappy database

  • Save and restore ("persist") your data to/from a file. Probably using CSV format.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment