 class Animal {
-    private let name : String?
+    private let name: String
     
-    init (name: String) {
+    init(name: String) {
         self.name = name
     }
     
-    func sound () -> String {
+    func sound() -> String {
         preconditionFailure("This method must be overridden")
     }
     
-    func speak () {
-        print("\(self.name!) says \(self.sound())")
+    func speak() -> String {
+        return "\(self.name) says \(self.sound())"
     }
 }
 
-class Cow : Animal {
-    override init (name : String) {
+class Cow: Animal {
+    override init(name: String) {
         super.init(name: name)
     }
     

    }
}

class Horse : Animal {
    override init (name : String) {
        super.init(name: name)
    }
    

    }
}

let h: Animal = Horse(name: "CJ")
assert(h.speak() == "CJ says neigh")
let c: Animal = Cow(name: "Bessie")
assert(c.speak() == "Bessie says moooo")
assert(Sheep(name:"Little Lamb").speak() == "Little Lamb says baaaa")
