Giter VIP home page Giter VIP logo

hs-ruby-refresh-todo's Introduction

All of the Goats

  1. Create a Goat class.

  1. Goats have the following attributes: age, name, pokes (an integer that defaults to zero on initialization), milk_in_udders (a float that defaults to one on initialization), moody (a true/false boolean that defaults to false upon initialization).

  1. Create the following actions: a. A poke method that makes the goat puts "baa" if the number of pokes is less that 3. If the goat has more than 3 pokes, it should puts "BAAAAAAAAA GO AWAY" and set the moody attribute to true. The method should also increment the number of pokes by one.

b. A milk method that reduces the milk_in_udders quantity by 50%. It should puts "You have milked _____ ml of milk" replacing the blank with the amount that was milked.

c. A feed method that takes different types of food as an argument. Here's what happens for each type of food: + Grass will increase the milk_in_udders by 30% + Muesli will increase the milk_in_udders by 40% + Tofurkey will increase the milk_in_udders by 25% + Any other food will cause the goat to throw up (putsing "BAAAAA"), and decrease the milk_in_udders by 10%

Now create an instance of Goat, poke it until it gets moody, feed it and milk it. Add any other additional methods you want!

View All of the Goats on Learn.co and start learning to code for free.

hs-ruby-refresh-todo's People

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.