Git Product home page Git Product logo

oo-barking-dog-q-000's Introduction

Barking Dog

Objectives

  1. Practice defining a class
  2. Build instance methods––both setter and getter

dog cartoon

Introduction

In this lab, you'll be creating a Dog class. Every instance of a Dog should have a name and be able to bark. In other words, I should be able to do:

fido = Dog.new
fido.name = "Fido"

fido.name
# => "Fido"

fido.bark
woof!
# => nil

Instructions

Run the test suite to get started. You'll be writing all your code in the lib/dog.rb file.

  1. Define a class, called Dog.
  2. Write a setter method, .name=, that allows you to give a dog a name.
  3. Write a getter method, .name that returns an individual dog's name.
  4. Write a method, .bark, that puts "woof!" when called on an instance of Dog.

View Barking Dog on Learn.co and start learning to code for free.

oo-barking-dog-q-000's People

Contributors

ahimmelstoss avatar deniznida avatar fislabstest avatar fs-lms-test-bot avatar ipc103 avatar irmiller22 avatar kthffmn avatar loganhasson avatar pletcher avatar sarogers avatar sophiedebenedetto avatar

Watchers

 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.