|
1 |
| -/** @module samples */ |
| 1 | +/** @module Exercises */ |
2 | 2 |
|
3 | 3 | const { StdOut } = require('../../src/libs')
|
4 | 4 |
|
5 | 5 | /**
|
6 |
| - * @summary Exercise x.x.x |
| 6 | + * Exercise C1S1E1 |
| 7 | + * @memberof module:Exercises |
7 | 8 | */
|
8 |
| -class Exercise { |
| 9 | +class C1S1E1 { |
9 | 10 | /**
|
10 |
| - * Code solution for Exercise x.x.x |
11 |
| - * @param {[number, number]} args - [x, y] |
12 |
| - * @example <caption>example 1</caption> |
13 |
| - * ```shell |
| 11 | + * Exercise solution. |
| 12 | + * @note Keep the `solution` method as the first one |
| 13 | + * so that it is easier to look at the examples. |
| 14 | + * Feel free to remove this note. |
| 15 | + * @example <caption>Multiplying 0.5 * 0.9</caption> |
| 16 | + * {@lang bash} |
14 | 17 | * $ node ex-x.x.x.js 0.5 0.9
|
15 | 18 | * x: 0.5
|
16 | 19 | * y: 0.9
|
17 | 20 | * x * y = 0.45
|
18 |
| - * ``` |
| 21 | + * @param {...string} args - Params: `[x, y]` |
| 22 | + * * @type {number} `args[0]` - Number `x`. |
| 23 | + * * @type {number} `args[1]` - Number `y`. |
19 | 24 | */
|
20 | 25 | static solution (args) {
|
21 | 26 | const x = parseFloat(args[0])
|
22 | 27 | const y = parseFloat(args[1])
|
23 | 28 |
|
24 | 29 | StdOut.println('x:', x)
|
25 | 30 | StdOut.println('y:', y)
|
26 |
| - StdOut.println('x * y =', parseFloat(x) * parseFloat(y)) |
| 31 | + StdOut.println('x * y =', x * y) |
| 32 | + } |
| 33 | + |
| 34 | + /** |
| 35 | + * Other methods go after `solution` method. |
| 36 | + */ |
| 37 | + static otherMethod () { |
| 38 | + // code goes here |
27 | 39 | }
|
28 | 40 | }
|
29 | 41 |
|
30 |
| -module.exports = Exercise |
| 42 | +// Exports |
| 43 | +// ============================== |
| 44 | + |
| 45 | +module.exports = C1S1E1 |
31 | 46 |
|
32 |
| -// Execution |
| 47 | +// Bash Execution |
33 | 48 | // ==============================
|
34 |
| -if (require.main === module) Exercise.solution(process.argv.slice(2)) |
| 49 | +if (require.main === module) C1S1E1.solution(process.argv.slice(2)) |
0 commit comments