ccbp js essentials
ccbp js essentials
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
function readLine() {
return inputString[currentLine++];
}
function main() {
const month = readLine();
/* Please do not modify anything above this line */
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
function readLine() {
return inputString[currentLine++];
}
function main() {
const name = readLine();
const role = readLine();
const salary = JSON.parse(readLine());
let taxPercent=0;
function Employee(name, role, salary) {
/* Please do not modify anything above this line */
this.name=name;
this.role=role;
this.salary=salary;
this.getTaxAmount=function (){
if (this.salary>=500000){
taxPercent=5;
}
else if(this.salary>=1000000){
Coding Solutions Youtube Channel
taxPercent=10;
}
return this.salary*taxPercent/100;
};
// Write your code here
3.Daily Routines
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
function readLine() {
return inputString[currentLine++];
}
function main() {
const isHotWaterReady = JSON.parse(readLine());
const isBreakfastReady = JSON.parse(readLine());
const takingShower=()=>{
return new Promise((resolve,reject)=>{
isHotWaterReady ? resolve("Taken Shower"):reject("Hot
Water Not Ready")
});
};
Coding Solutions Youtube Channel
const breakFast=()=>{
return new Promise((resolve,reject)=>{
isHotWaterReady ? resolve("Had
Breakfast"):reject("Breakfast Not Ready");
});
};
takingShower()
.then(result=>{
console.log(result);
return breakFast();
})
.then(result=>{
console.log(result);
return "Got to Work";
})
.then(result=>console.log(result))
.catch(error=>console.log(error))
}
4. Candidate Selections
Coding
"use strict"; Solutions Youtube Channel
process.stdin.resume();
process.stdin.setEncoding("utf-8");
function readLine() {
return inputString[currentLine++];
}
function main() {
const candidatesList = JSON.parse(readLine().replace(/'/g, '"'));
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
function readLine() {
return inputString[currentLine++];
}
function main() {
const myString = readLine();
const startString = readLine();
const endString = readLine();