From 832c0e6b50e8e018c057ad277d766cdfd1e42239 Mon Sep 17 00:00:00 2001 From: tparnell Date: Mon, 10 Dec 2018 16:44:57 -0500 Subject: [PATCH] fix bug --- Tip Calculator ocd JS/calculator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tip Calculator ocd JS/calculator.js b/Tip Calculator ocd JS/calculator.js index 9a1418f..1a4ac52 100644 --- a/Tip Calculator ocd JS/calculator.js +++ b/Tip Calculator ocd JS/calculator.js @@ -24,7 +24,7 @@ function totalAmount(billTotal, selectedPer, numPpl) { //Does the OCD calculations by rounding the total bill amount up to make a whole number. Then taking that number and subtracting it from the total bill, which gives you a new tip amount that makes the bill total to be a whole number. let ocdTotalAmount = Math.ceil(totalAmount); let ocdTipAmount = ocdTotalAmount - totalAmount; - let newTip = new Number((ocdTipAmount + tipAmount)).toFixed(2); + let newTip = new Number((ocdTotalAmount - billTotal)).toFixed(2); let billInfo = { prevBillTotal: billTotal, @@ -57,7 +57,7 @@ function splitBill(splitTotal, numPpl) { //Get the bill that is entered. function getTotalbill() { - return parseInt(document.getElementById('totalBillInput').value); + return parseFloat(document.getElementById('totalBillInput').value); } //Get the number of people entered. function getNumPpl() {