Tip
The formula to calculate the fare per kilometer is,
fare per kilometer = fare / distance
should be a single line containing the fare per kilometer
"use strict";
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.trim().split("\n").map((str) => str.trim());
main();
});
function readLine() {
return inputString[currentLine++];
}
/* not modify anything above this line */
function Ride(fare, distance) {
/* Write your code here */
}
/* not modify anything below this line */
function main() {
const fare = JSON.parse(readLine());
const distance = JSON.parse(readLine());
const ride1 = new Ride(fare, distance);
console.log(ride1.getFarePerKilometer());
}
function Ride(fare,distance){
let fare_per_kilometre = fare/distance;
console.log(fare_per_kilometre);
}
Ride(100,20);
//output is 5
Comments
Leave a comment