/*Copyright ElohimTov LLC*/ /* //Name: ElohimTov Solve Code - Operators - Javascript Solution //Problem: HackerRank - 30 Days of Code - Operators //Current File: ElohimTovSolve_Operators.(js).txt //Compile-able File: ElohimTovSolve_Operators.js //File: ElohimTovSolve_Operators.js.txt //Date: 11/05/2018 //Tale: ElohimTov Solve's Solution to HackerRank.com's // Operators problem, in Javascript programming language. // Problem link at https://elohimtov.com/elohimtov.info. */ 'use strict'; /* //CREDIT: The following process.stdin code was provided by HackerRank.com */ /***process.stdin code begins***/ process.stdin.resume(); process.stdin.setEncoding('utf-8'); let inputString = ''; let currentLine = 0; process.stdin.on('data', inputStdin => { inputString += inputStdin; }); process.stdin.on('end', _ => { inputString = inputString.replace(/\s*$/, '') .split('\n') .map(str => str.replace(/\s*$/, '')); main(); }); /***process.stdin code ends***/ function readLine() { return inputString[currentLine++]; }//ends function readLine /* Complete the solve function below. */ function solve(meal_cost, tip_percent, tax_percent) { /* Enter your code here */ var hundred = 100; var tip = (meal_cost*tip_percent)/hundred; var tax = (meal_cost*tax_percent)/hundred; var total = meal_cost + tip + tax; console.log(Math.round(total)); }//ends function solve /* //CREDIT: The following main() function was provided by HackerRank.com */ function main() { const meal_cost = parseFloat(readLine()); const tip_percent = parseInt(readLine(), 10); const tax_percent = parseInt(readLine(), 10); solve(meal_cost, tip_percent, tax_percent); }//ends function main /*Copyright ElohimTov LLC*/