 import UIKit
 
 class ViewController: UIViewController {
-    
+    var lastNumber :String = ""
     @IBOutlet var answerField: UILabel
     @IBOutlet var operatorField: UILabel
     

        }
    }
    
    @IBAction func enterTapped(theButton: UIButton){
        println(theButton.titleLabel.text)
    }
    
    @IBAction func clearTapped(theButton: UIButton){
        println(theButton.titleLabel.text)
        answerField.text = "0"
    }
    
    @IBAction func plusTapped(theButton: UIButton) {
        println(theButton.titleLabel.text)
        if operatorField.text == ""{
            operatorField.text = "+"
        }
    }

        println(theButton.titleLabel.text)
        if operatorField.text == ""{
            operatorField.text = "-"
            lastNumber = answerField.text
            answerField.text = "0"
        }else{
            enterTapped(nil)
            operatorField.text = "-"
        }
    }
    
    @IBAction func multiplyTapped(theButton: UIButton) {
        println(theButton.titleLabel.text)
        if operatorField.text == ""{
            operatorField.text = "*"
            lastNumber = answerField.text
            answerField.text = "0"
        }else{
            enterTapped(nil)
            operatorField.text = "*"
        }
    }
    
    @IBAction func divideTapped(theButton: UIButton) {
        println(theButton.titleLabel.text)
        if operatorField.text == ""{
            operatorField.text = "/"
            lastNumber = answerField.text
            answerField.text = "0"
        }else{
            enterTapped(nil)
            operatorField.text = "/"
        }
    }
    
    func showError(){
        println("There was an error. Please inspect.")
    }
}

