Skip to content

Instantly share code, notes, and snippets.

@TarasShu
Created June 10, 2020 10:41
Show Gist options
  • Save TarasShu/e8e2feac9da882cc915fd16a10546b25 to your computer and use it in GitHub Desktop.
Save TarasShu/e8e2feac9da882cc915fd16a10546b25 to your computer and use it in GitHub Desktop.
let totalRent: Double = 5340
let electricityRepairCost: Int = 414
let electricityBill: Double = 1241
let waterBill: Double
let arnonaBill: Double
let cleaningBill: Double
//struct Rent {
//
// let name: String
// let months: Int
// var bill: Int
// let sum: Int
// let electricityBill: Int
// let waterBill: Int
// let arnonaBill: Int
// let cleaningBill: Int
//}
struct Person {
var months: Int
let repairsElectricity: Bool
var totalBillElectricity: Double
func electricity(bill: Int) -> Double {
if repairsElectricity {
return (totalBillElectricity + Double(electricityRepairCost)) * months
} else if {
return totalBillElectricity
} else return totalBillElectricity + Double(electricityRepairCost) * months
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment