Skip to content

Commit 5c5604b

Browse files
author
Isaac Ramirez
committed
- update code samples
1 parent 9481e00 commit 5c5604b

File tree

2 files changed

+39
-20
lines changed

2 files changed

+39
-20
lines changed

docs/samples/ex-x.x.x.js

+27-12
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,49 @@
1-
/** @module samples */
1+
/** @module Exercises */
22

33
const { StdOut } = require('../../src/libs')
44

55
/**
6-
* @summary Exercise x.x.x
6+
* Exercise C1S1E1
7+
* @memberof module:Exercises
78
*/
8-
class Exercise {
9+
class C1S1E1 {
910
/**
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}
1417
* $ node ex-x.x.x.js 0.5 0.9
1518
* x: 0.5
1619
* y: 0.9
1720
* 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`.
1924
*/
2025
static solution (args) {
2126
const x = parseFloat(args[0])
2227
const y = parseFloat(args[1])
2328

2429
StdOut.println('x:', x)
2530
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
2739
}
2840
}
2941

30-
module.exports = Exercise
42+
// Exports
43+
// ==============================
44+
45+
module.exports = C1S1E1
3146

32-
// Execution
47+
// Bash Execution
3348
// ==============================
34-
if (require.main === module) Exercise.solution(process.argv.slice(2))
49+
if (require.main === module) C1S1E1.solution(process.argv.slice(2))

docs/samples/test.client.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,28 @@ const { StdOut } = require('../../src/libs')
1010
*/
1111
class TestClient {
1212
/**
13-
* Main static function
14-
* @param {Array<string>} args - Syntax: `[n, m]`
15-
* * The first number `n`
16-
* * The second number `m`
17-
* @returns {number} `n` * `m`
18-
* @example <caption>testing the client</caption>
13+
* Outputs the multiplication of `n * m`.
14+
* @example <caption>Multiplying 10 * 50</caption>
1915
* {@lang bash}
2016
* $ ./client TestClient 10 50
2117
* 500
18+
* @param {...string} args - Params: `[n, m]`
19+
* * @type {number} `args[0]` - Number `n`.
20+
* * @type {number} `args[1]` - Number `m`.
2221
*/
2322
static main (args) {
2423
const n = parseInt(args[0])
2524
const m = parseInt(args[1])
2625

2726
StdOut.println(n * m)
2827
}
29-
}
3028

31-
TestClient.main()
29+
/**
30+
* Other methods go after `main` method.
31+
*/
32+
static otherMethod () {
33+
// your code goes here
34+
}
35+
}
3236

3337
module.exports = { TestClient }

0 commit comments

Comments
 (0)