From 28a696fb75a585c0a0b6845ebd495d3edf2c06a2 Mon Sep 17 00:00:00 2001 From: Yonatan Teklemariam Date: Tue, 7 Jul 2026 07:29:16 +0100 Subject: [PATCH 1/3] reverted to original --- Sprint-1/fix/median.js | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/Sprint-1/fix/median.js b/Sprint-1/fix/median.js index b22590bc6..a1e52d497 100644 --- a/Sprint-1/fix/median.js +++ b/Sprint-1/fix/median.js @@ -6,9 +6,31 @@ // or 'list' has mixed values (the function is expected to sort only numbers). function calculateMedian(list) { - const middleIndex = Math.floor(list.length / 2); - const median = list.splice(middleIndex, 1)[0]; - return median; + if (!Array.isArray(list)) { + return null; + } + if (list.length === 0) { + return null; + } + const numbersOnly = list.filter((item) => typeof item === "number"); + if (numbersOnly.length === 0) { + return null; + } + const sorted = [...numbersOnly].sort((a, b) => a - b); + const middleIndex = Math.floor(sorted.length / 2); + if (sorted.length % 2 === 0) { + const median = (sorted[middleIndex - 1] + sorted[middleIndex]) / 2; + return median; + } + return sorted[middleIndex]; } +/* +const middleIndex = Math.floor(list.length / 2); +const median = list.splice(middleIndex, 1)[0]; +return median; +*/ module.exports = calculateMedian; +/* + + */ From cff19af51abaccc5438b6f625a4565711f1ac370 Mon Sep 17 00:00:00 2001 From: Yonatan Teklemariam Date: Tue, 7 Jul 2026 07:45:43 +0100 Subject: [PATCH 2/3] reverted to original --- Sprint-1/fix/median.js | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/Sprint-1/fix/median.js b/Sprint-1/fix/median.js index a1e52d497..b22590bc6 100644 --- a/Sprint-1/fix/median.js +++ b/Sprint-1/fix/median.js @@ -6,31 +6,9 @@ // or 'list' has mixed values (the function is expected to sort only numbers). function calculateMedian(list) { - if (!Array.isArray(list)) { - return null; - } - if (list.length === 0) { - return null; - } - const numbersOnly = list.filter((item) => typeof item === "number"); - if (numbersOnly.length === 0) { - return null; - } - const sorted = [...numbersOnly].sort((a, b) => a - b); - const middleIndex = Math.floor(sorted.length / 2); - if (sorted.length % 2 === 0) { - const median = (sorted[middleIndex - 1] + sorted[middleIndex]) / 2; - return median; - } - return sorted[middleIndex]; + const middleIndex = Math.floor(list.length / 2); + const median = list.splice(middleIndex, 1)[0]; + return median; } -/* -const middleIndex = Math.floor(list.length / 2); -const median = list.splice(middleIndex, 1)[0]; -return median; -*/ module.exports = calculateMedian; -/* - - */ From 817f8118eb6c8d3e8479aed87e5f8437b68f6679 Mon Sep 17 00:00:00 2001 From: Yonatan Teklemariam Date: Mon, 3 Aug 2026 07:36:48 +0100 Subject: [PATCH 3/3] implemented the quote generator based on the instructions provided --- Sprint-3/quote-generator/index.html | 32 +++++++++++-------- Sprint-3/quote-generator/quotes.js | 7 +++++ Sprint-3/quote-generator/style.css | 49 ++++++++++++++++++++++++++++- 3 files changed, 74 insertions(+), 14 deletions(-) diff --git a/Sprint-3/quote-generator/index.html b/Sprint-3/quote-generator/index.html index 30b434bcf..bce58ef1a 100644 --- a/Sprint-3/quote-generator/index.html +++ b/Sprint-3/quote-generator/index.html @@ -1,15 +1,21 @@ - - - - Title here - - - -

hello there

-

-

- - - + + + + + Quote Generator + + + + + +
+

Quote of the Day

+

"this is the quote"

+

- Author Name

+
+ + + + \ No newline at end of file diff --git a/Sprint-3/quote-generator/quotes.js b/Sprint-3/quote-generator/quotes.js index 4a4d04b72..c218c7111 100644 --- a/Sprint-3/quote-generator/quotes.js +++ b/Sprint-3/quote-generator/quotes.js @@ -1,3 +1,10 @@ +function generateQuote() { + const randomQuote = pickFromArray(quotes); + document.getElementById("quote").textContent = `"${randomQuote.quote}"`; + document.getElementById("author").textContent = `- ${randomQuote.author}`; +} +generateQuote(); + // DO NOT EDIT BELOW HERE // pickFromArray is a function which will return one item, at diff --git a/Sprint-3/quote-generator/style.css b/Sprint-3/quote-generator/style.css index 63cedf2d2..c4c7a3f86 100644 --- a/Sprint-3/quote-generator/style.css +++ b/Sprint-3/quote-generator/style.css @@ -1 +1,48 @@ -/** Write your CSS in here **/ +body { + margin: 0; + padding: 0; + justify-content: center; + font-family: Arial, sans-serif; + background-color: #d4b4ec; +} + +.quote-box { + margin: 50px auto; + width: 80%; + max-width: 600px; + padding: 30px; + text-align: center; + background-color: #fff; + border-radius: 10px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); +} + +h1 { + margin-bottom: 25px; +} +#quote { + min-height: 60px; + margin-bottom: 25px; + font-size: 1.5em; + line-height: 1.5; + font-style: italic; +} + +button { + display: block; + margin: 20px auto; + font-weight: bold; + padding: 12px 20px; + font-size: 1.5em; + background-color: rgba(96, 55, 92, 0.2); + color: #232b2e; + border: none; + cursor: pointer; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); +} + +button:hover { + background-color: rgba(53, 31, 51, 0.2); + font-weight: bold; + text-shadow: 0 1px 2px white; +}