"use strict";

  function Dog(spec) {
          let { name, age, color, breed, sex } = spec,

            getName = function getName() {
                  return name;
            },

            setName = function setName(newName) {
              if(typeof newName === "string" && newName.length > 0) {
                name = newName;
              }
            },

            getAge = function getAge() {
                  return age;
            },

            setAge = function setAge(newAge) {
              if(typeof newAge === "number" && newAge >= 0) {
                age = newAge;
              }
            },

            getColor = function getColor() {
                  return color;
            },

            setColor = function setColor(newColor) {
              if(typeof newColor === "string" && newColor.length > 0) {
                color = newColor;
              }
            },

            getBreed = function getBreed() {
                  return breed;
            },

            setBreed = function setBreed(newBreed) {
              if(typeof newBreed === "string" && newBreed.length > 0) {
                breed = newBreed;
              }
            },

            getSex = function getSex() {
                  return sex;
            },

            setSex = function setSex(newSex) {
              if(typeof newSex === "string" && newSex.length > 0) {
                sex = newSex;
              }
            };

        return Object.freeze({
              getName, setName,
              getAge, setAge,
              getColor, setColor,
              getBreed, setBreed,
              getSex, setSex
             });
  }

  var Bud = Dog({
    name: "Bud",
    age: 10,
    color: "gold",
    breed: "golden retriever",
    sex: "male"
  });

  var Marsha = Dog({
    name: "Marsha",
    age: 1,
    color: "black",
    breed: "yorkshire terrier",
    sex: "female"
  });

  var Fido = Dog({
    name: "Fido",
    age: 5,
    color: "brown",
    breed: "australian shepherd",
    sex: "male"
  });

  Bud.setName("Ralph");
  console.log(Bud.getName());
  Fido.setAge(6);
  console.log(Fido.getAge());
  Marsha.setColor("brown");
  console.log(Marsha.getColor());