From 7629e612189d711959fc5ee8948ac2e649a7b050 Mon Sep 17 00:00:00 2001 From: Kibonakamura Date: Wed, 29 Nov 2017 10:57:18 +0000 Subject: [PATCH] Swift 3 update The round(someDecimal) is the old C style. Doubles and floats have a built in Swift function now. --- 2 - Operators/Solution.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/2 - Operators/Solution.swift b/2 - Operators/Solution.swift index c87a5fb..0287ac9 100644 --- a/2 - Operators/Solution.swift +++ b/2 - Operators/Solution.swift @@ -4,8 +4,8 @@ let mealCost = Double(readLine()!)! let tipPercent = Int(readLine()!)! let taxPercent = Int(readLine()!)! -let tip = Double(tipPercent) * mealCost / 100; -let tax = Double(taxPercent) * mealCost / 100; +let tip = Double(tipPercent) * mealCost / 100 +let tax = Double(taxPercent) * mealCost / 100 -let totalCost = round(tip + tax + mealCost); -print("The total meal cost is \(Int(totalCost)) dollars.") +let totalCost = tip + tax + mealCost +print("The total meal cost is \(Int(totalCost.rounded())) dollars.")