Created
October 28, 2019 09:38
-
-
Save ayal/869d76187dda3f16b1363c29aa81ab54 to your computer and use it in GitHub Desktop.
oren split airbnb bills
This file contains hidden or 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
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