Hi, I am new here without any coding skills but willing to learn. I know how
to use html code. I am thinking of how to write the code for below scenario
to create a simple online customize calculator:
There is 1 box which allow us to enter any number=x (representing amount of money).
So whenever we entered a number in the box and click "CALCULATE" buton below the box,
there will be 3 results generated in 3 boxes below it based on the set of of rules
1. if the amount entered is <21,000
Result 1 = 1.5%*x*12
Result 2 = 1.5%*x*48
Result 3 = 1.5%*x*120
2. if the amount entered is >=21,000 and <210,000
Result 1 = 1.8%*x*12
Result 2 = 1.8%*x*48
Result 3 = 1.8%*x*120
3. if the amount entered is >=210,000
Result 1 = 2.2%*x*12
Result 2 = 2.2%*x*48
Result 3 = 2.2%*x*120
I understand that this code will involve If...else if...else Statement..
Anyone can give me any references/examples similar to this scenario? Thanks.
For myself, I see that is likely to cause confusion. I might perhaps write var x,y,z; but I would not do that if the variable was initialised with an expression such as you are using. I cannot see any advantage in that. But each to his taste!
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.