In this question I wanted to calculate the percentage of commission a person gets for his sales. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

In this question I wanted to calculate the percentage of commission a person gets for his sales.

function mycommission(){ varamt=Number(document.getElementById("amount").value); var sum=0; switch (true) { case (amt>20000):{ let val=Math.round((10/100)*amt); console.log(sum); sum=sum+val; } case (amt>10001 || amt<20000):{ let val=Math.round((7/100)*20000); console.log(sum); sum=sum+val; } case (amt>5001 || amt<10000 ):{ let val=Math.round((5/100)*10000); console.log(sum); sum=sum+val; } case (amt>0||amt<5000):{ let val=Math.round((2/100)*5000); console.log(sum); sum=sum+val; console.log(val,sum); } default: document.getElementById('printamt').innerHTML="Your Commission is "+sum+"."; break; }}

19th Jul 2020, 7:00 PM
내고^×^친구🐈
내고^×^친구🐈 - avatar
1 Answer
0
You really should put your code into a code playground project and use a proper formatting. If you then provide the link to it here, it's quite easier to help.
19th Jul 2020, 7:16 PM
Sandra Meyer
Sandra Meyer - avatar