Answer to Question #295277 in HTML/JavaScript Web Application for chethan

Question #295277



tax criteria

salary tax percentage

>= 50000 5

>= 1000000 10


quick tip

tax = salary * taxPercentage/100


input 1

stuart

developer

840000


output 1

42000


"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++];

}


function main() {

 const name = readLine();

 const role = readLine();

 const salary = JSON.parse(readLine());


 function Employee(name, role, salary) {



  // Write your code here


 }


 const employee1 = // Write your code here


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


 console.log(employee1.getTaxAmount());

}

















1
Expert's answer
2022-02-10T00:19:07-0500
"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++];
}

function main() {
    const name = readLine();
    const role = readLine();
    const salary = JSON.parse(readLine());

    function Employee(name, role, salary) {
        return {
            name: name,
            role: role,
            salary: salary,

            getTaxAmount() {
                if (salary >= 1000000) return salary*0.1
                else if (salary >= 50000) return salary*0.05
                else return 0
            }
        }
    }

    const employee1 = Employee(name, role, salary);

/* Please do not modify anything below this line */
    console.log(employee1.getTaxAmount());
}

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