From 765dc7031af350607184c1569fe7d2a36bfa315e Mon Sep 17 00:00:00 2001 From: octopusGarden Date: Tue, 25 Oct 2022 14:30:50 -0400 Subject: [PATCH] Completed seventh exercise --- 07_tempConversion/tempConversion.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/07_tempConversion/tempConversion.js b/07_tempConversion/tempConversion.js index 6ef3e85..12ede60 100644 --- a/07_tempConversion/tempConversion.js +++ b/07_tempConversion/tempConversion.js @@ -1,9 +1,17 @@ -const ftoc = function() { - +const ftoc = function(fnum) { + //formula to convert f to c + let cnum = (fnum - 32) * 5 % 9; + //round to one decimal + let roundCnum = parseInt(cnum.toFixed(1)); + return roundCnum; }; const ctof = function() { - + //formula to convert c to f + let fnum = (cnum * 9/5) + 32; + //round to one decimal + let roundFnum = parseInt(fnum.toFixed(0)); + return roundFnum; }; // Do not edit below this line