Answer to Question #176886 in HTML/JavaScript Web Application for adhi chinna

Question #176886

Fare per Kilometer

Given total fare

fare and distance travelled in kilometers distance for a rental bike, write a JS constructor function with a method to calculate the fare per kilometer.

Quick Tip

The formula to calculate the fare per kilometer is,

fare per kilometer = fare / distance

Input

The first line of input contains a number

fare The second line of input contains a number distanceOutput

The output should be a single line containing the fare per kilometer


1
Expert's answer
2021-04-09T03:41:03-0400
function farePerKilometer(fare, distanceOutput) {
    return fare / distanceOutput
}

let fare = 200;
let distanceOutput = 20;

console.log('fare per kilometer = ' + farePerKilometer(fare, distanceOutput) );

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS