Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js

D3 - Lottery number re-order exercise

 

Your colleague was working last night on a task that code-wise has been almost finished. The problem is that he apparently got drunk at some point and messed up with the order of execution of the program. 

Without changing the code, except only for putting the necessary curly braces to find the right code blocks order execution, reorder the lines shown in the photo above in order to achieve the following result.

The program accepts 3 inputs and reads them.

The first is a random lottery  number from 1 to 1000 (in this case will be a give number) that a customer buys from you. Feel free to define this number manually.

The second is the jackpot winning prize that is 1000$.

And a third input is the standard winnings. The latter acts like a basis. The basis is 10$ but it can be much more or nothing depending on the area the random number belongs to (for now give a value of 10$ there).

In case the number the customer bought is from 1 to 499 the earnings become from 10$ to 0. So if the customer gets a number withing this range, he wins nothing.

If the number the customer bought, is between 500 and 699 or between 800 and 899 then he wins the basis twice.

In case he picks a number that belongs to 700 area (700-799) he wins the basis 10 times!

Especially the numbers 776, 777, 778 they produce another winning pot. 777 gives him the jackpot. 776 gives him half of the jackpot and 778 gives him the 1/5 of the jackpot.

In any other number circumstance (900 and more or so)   the customer takes the basis 5 times.

Reorder the exercise lines accordingly, add the curly braces where missing, and don't forget to print to console a descriptive message that includes the winnings of the customer.