Hello, good evening
I am doing challenge # 9 in the Lesson of Instances. And I am not sure if my code is right. Also I have a doubt if I made a correct choice in making numPerson Double in the division line.
import UIKit
struct TaxCalulator {
var tax = 1.16
func totalWithTax(a: Double) -> Double {
return a * tax
}
}
struct BillSplitter {
func splitBy(subTotal: Double, numPeople: Int) -> Double{
let total = TaxCalulator()
let check = total.totalWithTax(a: subTotal)
let split = check / Double(numPeople)
return split
}
}
var myCheck = BillSplitter()
var final = myCheck.splitBy(subTotal: 120, numPeople: 5)
print(final)
thank you so much!!!