Skip to content

Instantly share code, notes, and snippets.

@cekici
Last active January 27, 2016 15:22
Show Gist options
  • Save cekici/830742520e9f536d85d1 to your computer and use it in GitHub Desktop.
Save cekici/830742520e9f536d85d1 to your computer and use it in GitHub Desktop.
Muhammet'in yeme algoritması
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