Skip to content

Instantly share code, notes, and snippets.

@andersonFaro9
Last active December 1, 2015 14:01
Show Gist options
  • Save andersonFaro9/f8afe159687ec358bf8c to your computer and use it in GitHub Desktop.
Save andersonFaro9/f8afe159687ec358bf8c to your computer and use it in GitHub Desktop.
//: Playground - noun: a place where people can play
func totalCusto ()->Int {
let watts = 300// pega os dados do input
let tensao = 100// pega os dados do input
let potencia = 420// pega os dados do input
let horas = 124 // pega os dados do input
let dias = 6779 // pega os dados do input
let kwh = 0.88447066
if watts != 0 {
let amp = watts / potencia
let pot = (amp / potencia) / 1000
let potHoras = pot * horas
let total = Int(potHoras) * dias * Int(kwh)
//print(total)
return total
}
else{
let pot = (tensao / potencia) / 1000
let potHoras = pot * horas
print(potHoras)
let total = Int(potHoras) * dias * Int(kwh)
//print(total)
return total
}
}
totalCusto ()
// 4 inputs para o usuario igual o site www.komodotecnologia.xyz + o input com o campo watts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment