Answer to Question #197924 in HTML/JavaScript Web Application for sai

Question #197924

"use strict";



process.stdin.on("end", (_) => {

 inputString = inputString.trim().split("\n").map((str) => str.trim());

 main();

});


function readLine() {

 return inputString[currentLine++];

}


/* Please do not modify anything above this line */


class Submarine {

 constructor() {

  this.isSubmerged = false;

 }


 /* Write your code here */

}


class WeaponUnit extends Submarine {

  

 /* Write your code here */


}


/* Please do not modify anything below this line */


function main() {

 const totalTorpedos = parseInt(readLine());

 const torpedosFired = parseInt(readLine());  

  

 const weaponUnit1 = new WeaponUnit(totalTorpedos, torpedosFired);

  

 weaponUnit1.dive();

 weaponUnit1.fireTorpedos();

 weaponUnit1.surface();

}


1
Expert's answer
2021-05-25T00:08:39-0400
'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(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 * appreciation / 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