Answer to Question #200423 in HTML/JavaScript Web Application for Hari nadh babu

Question #200423

In this javascript code there are 4 test cases, 4th test case was not getting expected output


Test cases are in below url link

https://drive.google.com/file/d/1pUV22FRZxZXuZQdyywfDXs2pS30r6dKc/view?usp=sharing


Code in below url link

https://drive.google.com/file/d/15gIWqTU2mGKhr8gaVS-lVXNed5jxPXXQ/view?usp=sharing









1
Expert's answer
2021-05-30T07:24:08-0400
/* Please do not modify anything above this line */
function main() {
  const dayCharge = JSON.parse(readLine());
  const days = parseInt(readLine());
 
  let bill, discount;
    bill = dayCharge * days;
    if (days > 2 && days <= 5) { // changes >= to >
      discount = 5;
     bill= bill - (bill * discount) / 100;
    }
    if (days > 5) {              // changed >= to >
      discount = 15;
     bill= bill - (bill * discount) / 100;
    }
    console.log(`${bill}`);
}

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

Hari nadh babu
30.05.21, 16:06

Awesome ! Thank u you very much

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS