Skip to content

Instantly share code, notes, and snippets.

@ayal
Created October 28, 2019 09:38
Show Gist options
  • Save ayal/869d76187dda3f16b1363c29aa81ab54 to your computer and use it in GitHub Desktop.
Save ayal/869d76187dda3f16b1363c29aa81ab54 to your computer and use it in GitHub Desktop.
oren split airbnb bills
var amount = 1000;
var billDays = 1000 ;
var yesGuestDays = 1000;
///
var noGuestDays = billDays - yesGuestDays;
var amountPerDay = amount / billDays;
var orenPay = (amountPerDay / 2) * noGuestDays + (amountPerDay / 3) * yesGuestDays;
var ayalPay = amount - orenPay;
console.log(`Oren: ${orenPay.toFixed(0)}, (${((orenPay / amount)*100).toFixed(0)}%)
Ayal: ${ayalPay.toFixed(0)}, (${((ayalPay / amount)*100).toFixed(0)}%)`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment