the goal of this coding exam is to quickly get you of the ground with this in the object methods
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());
}
"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());
}
Comments
Leave a comment