Git Product home page Git Product logo

oo-meowing-cat-london-web-121018's Introduction

Meowing Cat

Objectives

  1. Practice defining a class
  2. Use macros to create setter and getter methods

maru in a box

Introduction

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

maru = Cat.new
maru.name = "Maru"

maru.name
# => "Maru"

maru.meow
# "meow!"
# => nil

Instructions

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

  1. Define a class, called Cat.
  2. Use the attr_accessor macro to create a setter and getter method for a cat's name.
  3. Write a method, .meow, that outputs "meow!" to the terminal using the puts method when called on an instance of Cat.

View Meowing Cat on Learn.co and start learning to code for free.

oo-meowing-cat-london-web-121018's People

Contributors

annjohn avatar anthonyrnl avatar aturkewi avatar danielseehausen avatar deniznida avatar ipc103 avatar joshuabamboo avatar maxwellbenton avatar nancyhawa avatar sarogers avatar sophiedebenedetto avatar

Watchers

 avatar  avatar  avatar  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.