ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 12 May 2017 My Price 11.00

/Calculator.swift

0down vote favorite

I am receiving an expected declaration error at the do { line. I have tried researching this and read over the Apple developer information for Swift 3 on try/catch statements but have not been able to figure this out. Any help would be appreciated.

 

////Calculator.swift//KellyWeek1////Created by Kelly Heath on 9/28/16.//Copyright © 2016 Kelly Heath. All rights reserved.//import Foundationimport UIKitclass Calculator: ViewController {var numerator : Float?var denominator : Float?var total : Float?var display = "0"enum divisionErrors: Error {case infcase nan}func divide(num: Float, by denum: Float) throws -> Float {guard num != 0 else{throw divisionErrors.nan}guard denum != 0 else{throw divisionErrors.inf}let computedValue = num / denumreturn computedValue}do {catch divisionErrors.inf {print("Error")}display = "0"catch divisionErrors.nan {print("Error")}display = "0"}}

Answers

(11)
Status NEW Posted 12 May 2017 01:05 AM My Price 11.00

-----------

Not Rated(0)