File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed
Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ process . stdin . resume ( ) ;
4+ process . stdin . setEncoding ( 'utf-8' ) ;
5+
6+ let inputString = '' ;
7+ let currentLine = 0 ;
8+
9+ process . stdin . on ( 'data' , inputStdin => {
10+ inputString += inputStdin ;
11+ } ) ;
12+
13+ process . stdin . on ( 'end' , _ => {
14+ inputString = inputString . trim ( ) . split ( '\n' ) . map ( string => {
15+ return string . trim ( ) ;
16+ } ) ;
17+
18+ main ( ) ;
19+ } ) ;
20+
21+ function readLine ( ) {
22+ return inputString [ currentLine ++ ] ;
23+ }
24+
25+ /**
26+ * Calculate the area of a rectangle.
27+ *
28+ * length: The length of the rectangle.
29+ * width: The width of the rectangle.
30+ *
31+ * Return a number denoting the rectangle's area.
32+ **/
33+ function getArea ( length , width ) {
34+ let area ;
35+ // Write your code here
36+ area = length * width ;
37+ return area ;
38+ }
39+
40+ /**
41+ * Calculate the perimeter of a rectangle.
42+ *
43+ * length: The length of the rectangle.
44+ * width: The width of the rectangle.
45+ *
46+ * Return a number denoting the perimeter of a rectangle.
47+ **/
48+ function getPerimeter ( length , width ) {
49+ let perimeter ;
50+ // Write your code here
51+ perimeter = 2 * ( length + width ) ;
52+ return perimeter ;
53+ }
54+
You can’t perform that action at this time.
0 commit comments