Classes Review

Create the following objects

  1. Create a class for a Pet

    • attributes

      • owner - string
      • name - string
      • walk - a method that logs 'walka walka'
    • instantiating a new pet takes the pets name as a parameter and sets the attribute;
    • create one pet and log it
    • run the walk method to make sure it works as expected
  2. Create a class for a Dog

    • this should inherit from Pet
    • attributes

      • price - 20
    • methods

      • bark() - log "bark"
      • chaseTail() - log "oh boy oh boy oh boy"
      • getPrice() - return price
    • create a new dog and log it
    • test all the methods to make sure they work as expected
  3. Create a class for a Cat

    • this should inherit from Pet
    • attributes

      • price - 10
    • methods

      • purr() - log "purrrrr"
      • clean() - log "cleaning"
      • getPrice() - return price
      • walk() - overwrite the method to console.log 'strut strut'
    • create a new cat and log it
    • test all the methods to make sure they work as expected
  4. update one property of the dog after it has been created and log it to check
  5. updated one property of the cat after it has been creatd and log it to check