Swift code
I need code (Swift 3) for the following two buttons:
@IBAction func dividePressed(_ sender: AnyObject)
@IBAction func addPressed(_ sender: AnyObject)
The code needs to have:
· Public variables of the type float called numerator, denominator and total.
· A method called 'Add' that returns the sum of numerator and denominator and sets the total variable.
· A method called 'Divide that returns the division of the numerator and denominator and sets the total. The 'Divide' method should contains a 'try/catch' to ensure that dividing by zero is addressed.
· Use the add and divide method in the class to return results when the buttons are clicked
10 years ago 20
Answer(0)
Bids(0)
other Questions(10)