Answer to Question #270422 in HTML/JavaScript Web Application for prime

Question #270422

Passes test cases 3/5

Sample Input 1

1000
2
3

Sample Output 1

1060

These are just samples. There are other test cases too.

let inputString = '';

let currentLine = 0;

process.stdin.on('data', inputStdin => {

    inputString += inputStdin;

});

process.stdin.on('end', _ => {

    inputString = inputString.trim().split('\n').map(string => {

        return string.trim();

    });

    main();    

});

function readLine() {

    return inputString[currentLine++];

    return input === undefined ? undefined : JSON.parse(input);

}

function calculateFinalValueWithAppreciation(principal, time, apprPercentage) {

  let finalValue;

  finalValue = principal * (1 + time * apprPercentage / 100);

  return finalValue;

}

function main() {

    const principal = readLine();  

    const time = readLine();

    const apprPercentage = readLine();

    const finalValue = calculateFinalValueWithAppreciation(principal, time, apprPercentage);

    console.log(finalValue);

}



1
Expert's answer
2021-11-26T07:08:06-0500
let inputString = '';
let currentLine = 0;


process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});


process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    main();    
});


function readLine() {
    return inputString[currentLine++];
    return input === undefined ? undefined : JSON.parse(input);
}


function calculateFinalValueWithAppreciation(principal, time, apprPercentage) {
  let finalValue;
  finalValue = principal * (1 + time * apprPercentage / 100);
  return finalValue;
}


function main() {
    const principal = readLine();  
    const time = readLine();
    const apprPercentage = readLine();
    const finalValue = calculateFinalValueWithAppreciation(principal, time, apprPercentage);
    console.log(finalValue);
}

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