From 8f6660327597192d64021822b37bf1742f132d63 Mon Sep 17 00:00:00 2001 From: Ben Lloyd Pearson Date: Tue, 27 Jun 2023 16:47:34 -0400 Subject: [PATCH 1/5] Estimated Time to Review --- Standard/estimated-time-to-review/file1.js | 46 ++++++++++++++++++++++ Standard/estimated-time-to-review/file2.js | 46 ++++++++++++++++++++++ Standard/estimated-time-to-review/file3.js | 46 ++++++++++++++++++++++ Standard/estimated-time-to-review/file4.js | 46 ++++++++++++++++++++++ 4 files changed, 184 insertions(+) create mode 100644 Standard/estimated-time-to-review/file1.js create mode 100644 Standard/estimated-time-to-review/file2.js create mode 100644 Standard/estimated-time-to-review/file3.js create mode 100644 Standard/estimated-time-to-review/file4.js diff --git a/Standard/estimated-time-to-review/file1.js b/Standard/estimated-time-to-review/file1.js new file mode 100644 index 0000000..46247aa --- /dev/null +++ b/Standard/estimated-time-to-review/file1.js @@ -0,0 +1,46 @@ +const readline = require('readline'); + +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); + +const performCalculation = (num1, operator, num2) => { + num1 = parseFloat(num1); + num2 = parseFloat(num2); + + let result; + switch (operator) { + case '+': + result = num1 + num2; + break; + case '-': + result = num1 - num2; + break; + case '*': + result = num1 * num2; + break; + case '/': + if (num2 !== 0) { + result = num1 / num2; + } else { + console.log("Error! Division by zero is not allowed."); + return; + } + break; + default: + console.log(`Unknown operator '${operator}'. Please use one of the following: +, -, *, /`); + return; + } + + console.log(`The result of ${num1} ${operator} ${num2} is ${result}`); +}; + +rl.question('Enter the first number: ', (answer1) => { + rl.question('Enter the operator (+, -, *, /): ', (operator) => { + rl.question('Enter the second number: ', (answer2) => { + performCalculation(answer1, operator, answer2); + rl.close(); + }); + }); +}); diff --git a/Standard/estimated-time-to-review/file2.js b/Standard/estimated-time-to-review/file2.js new file mode 100644 index 0000000..46247aa --- /dev/null +++ b/Standard/estimated-time-to-review/file2.js @@ -0,0 +1,46 @@ +const readline = require('readline'); + +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); + +const performCalculation = (num1, operator, num2) => { + num1 = parseFloat(num1); + num2 = parseFloat(num2); + + let result; + switch (operator) { + case '+': + result = num1 + num2; + break; + case '-': + result = num1 - num2; + break; + case '*': + result = num1 * num2; + break; + case '/': + if (num2 !== 0) { + result = num1 / num2; + } else { + console.log("Error! Division by zero is not allowed."); + return; + } + break; + default: + console.log(`Unknown operator '${operator}'. Please use one of the following: +, -, *, /`); + return; + } + + console.log(`The result of ${num1} ${operator} ${num2} is ${result}`); +}; + +rl.question('Enter the first number: ', (answer1) => { + rl.question('Enter the operator (+, -, *, /): ', (operator) => { + rl.question('Enter the second number: ', (answer2) => { + performCalculation(answer1, operator, answer2); + rl.close(); + }); + }); +}); diff --git a/Standard/estimated-time-to-review/file3.js b/Standard/estimated-time-to-review/file3.js new file mode 100644 index 0000000..46247aa --- /dev/null +++ b/Standard/estimated-time-to-review/file3.js @@ -0,0 +1,46 @@ +const readline = require('readline'); + +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); + +const performCalculation = (num1, operator, num2) => { + num1 = parseFloat(num1); + num2 = parseFloat(num2); + + let result; + switch (operator) { + case '+': + result = num1 + num2; + break; + case '-': + result = num1 - num2; + break; + case '*': + result = num1 * num2; + break; + case '/': + if (num2 !== 0) { + result = num1 / num2; + } else { + console.log("Error! Division by zero is not allowed."); + return; + } + break; + default: + console.log(`Unknown operator '${operator}'. Please use one of the following: +, -, *, /`); + return; + } + + console.log(`The result of ${num1} ${operator} ${num2} is ${result}`); +}; + +rl.question('Enter the first number: ', (answer1) => { + rl.question('Enter the operator (+, -, *, /): ', (operator) => { + rl.question('Enter the second number: ', (answer2) => { + performCalculation(answer1, operator, answer2); + rl.close(); + }); + }); +}); diff --git a/Standard/estimated-time-to-review/file4.js b/Standard/estimated-time-to-review/file4.js new file mode 100644 index 0000000..46247aa --- /dev/null +++ b/Standard/estimated-time-to-review/file4.js @@ -0,0 +1,46 @@ +const readline = require('readline'); + +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); + +const performCalculation = (num1, operator, num2) => { + num1 = parseFloat(num1); + num2 = parseFloat(num2); + + let result; + switch (operator) { + case '+': + result = num1 + num2; + break; + case '-': + result = num1 - num2; + break; + case '*': + result = num1 * num2; + break; + case '/': + if (num2 !== 0) { + result = num1 / num2; + } else { + console.log("Error! Division by zero is not allowed."); + return; + } + break; + default: + console.log(`Unknown operator '${operator}'. Please use one of the following: +, -, *, /`); + return; + } + + console.log(`The result of ${num1} ${operator} ${num2} is ${result}`); +}; + +rl.question('Enter the first number: ', (answer1) => { + rl.question('Enter the operator (+, -, *, /): ', (operator) => { + rl.question('Enter the second number: ', (answer2) => { + performCalculation(answer1, operator, answer2); + rl.close(); + }); + }); +}); From 4a8a1c9dc4894bbee28189f5d532ac6774f490d5 Mon Sep 17 00:00:00 2001 From: Ben Lloyd Pearson Date: Tue, 27 Jun 2023 17:02:30 -0400 Subject: [PATCH 2/5] Update file1.js --- Standard/estimated-time-to-review/file1.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Standard/estimated-time-to-review/file1.js b/Standard/estimated-time-to-review/file1.js index 46247aa..917a203 100644 --- a/Standard/estimated-time-to-review/file1.js +++ b/Standard/estimated-time-to-review/file1.js @@ -5,6 +5,7 @@ const rl = readline.createInterface({ output: process.stdout }); + const performCalculation = (num1, operator, num2) => { num1 = parseFloat(num1); num2 = parseFloat(num2); From e4639717d46c87dd3b7ecca7ba846be40f72fa16 Mon Sep 17 00:00:00 2001 From: Ofer Affias Date: Wed, 12 Jul 2023 11:23:28 -0400 Subject: [PATCH 3/5] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d920e72..4129f77 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # gitStream-examples Example PRs that demonstrate gitStream capabilities. + +change it From 0118797aab36d4fbf595e2c833d5d4efbd0e0912 Mon Sep 17 00:00:00 2001 From: Ofer Affias Date: Wed, 12 Jul 2023 13:09:35 -0400 Subject: [PATCH 4/5] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 4129f77..94e30fa 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ # gitStream-examples Example PRs that demonstrate gitStream capabilities. -change it From ab3664d3eadef04522925ca7d1bc3876b3b67954 Mon Sep 17 00:00:00 2001 From: Ofer Affias Date: Tue, 18 Jul 2023 16:57:17 +0300 Subject: [PATCH 5/5] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 94e30fa..d920e72 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,2 @@ # gitStream-examples Example PRs that demonstrate gitStream capabilities. -