You are viewing a single comment's thread. Return to all comments →
var mealCost: Double = Double(readLine()!)!
var tipPercent: Int = Int(readLine()!)!
var taxPercent: Int = Int(readLine()!)!
var tip: Double {
get { return mealCost * (Double(tipPercent) / 100) }
}
var tax: Double {
get { return mealCost * (Double(taxPercent) / 100) }
var totalCost: Double {
get { return mealCost + tip + tax }
print("The total meal cost is (lround(totalCost)) dollars.")
Seems like cookies are disabled on this browser, please enable them to open this website
Day 2: Operators
You are viewing a single comment's thread. Return to all comments →
var mealCost: Double = Double(readLine()!)!
var tipPercent: Int = Int(readLine()!)!
var taxPercent: Int = Int(readLine()!)!
var tip: Double {
}
var tax: Double {
}
var totalCost: Double {
}
print("The total meal cost is (lround(totalCost)) dollars.")