Last active
January 27, 2016 15:22
-
-
Save cekici/830742520e9f536d85d1 to your computer and use it in GitHub Desktop.
Muhammet'in yeme algoritması
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getMuhammetKacPorsiyonYer(porsiyonFiyati) { | |
//in TL | |
var muhammetSabiti = 20; | |
var porsiyon = muhammetSabiti / porsiyonFiyati; | |
if(porsiyon < 1) { | |
throw new Error('Cok pahali'); | |
} else if(porsiyon >= 1 && porsiyon < 1.5) { | |
return 1; | |
} else if(porsiyon >= 1.5 && porsiyon < 2) { | |
return 1.5; | |
} else if(porsiyon > 2 && porsiyon < 3) { | |
return 2; | |
} else { | |
throw new Error('Ucuzsa doyurmaz zaten'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment