From b21dedf095abc2a5f4e52d7adfc14b09b9fe492c Mon Sep 17 00:00:00 2001 From: Mustafa Homsi Date: Wed, 28 Jan 2026 09:11:38 +0100 Subject: [PATCH 1/4] w3 t1 done --- task-1/book.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/task-1/book.js b/task-1/book.js index 8b49ecc..0aa430a 100644 --- a/task-1/book.js +++ b/task-1/book.js @@ -1,3 +1,9 @@ function isBookApplicable(searchString) { - // Your code here + const isBookTitle = "The fundamentals of JavaScript"; + + const cleanSearchString = searchString.trim().toLowerCase(); + + const cleanTitle = isBookTitle.toLowerCase(); + + return cleanTitle.includes(cleanSearchString); } From a4e861fbf003804a9b4d43b82e5af8ab6ae95c41 Mon Sep 17 00:00:00 2001 From: Mustafa Homsi Date: Wed, 28 Jan 2026 09:32:44 +0100 Subject: [PATCH 2/4] w3 t2 done --- task-2/parse-date.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/task-2/parse-date.js b/task-2/parse-date.js index 877a3aa..5067e89 100644 --- a/task-2/parse-date.js +++ b/task-2/parse-date.js @@ -1 +1,25 @@ -// Your code here +function parseDateString(dateString) { + const trimmed = dateString.trim(); + + const parts = trimmed.split(/\s+/); + const format = parts[0]; + const datePart = parts[1]; + + const [first, second, yearStr] = datePart.split("-"); + + const year = Number(yearStr); + + if (format === "MDY") { + const month = Number(first); + const day = Number(second); + return { day, month, year,}; + } + + const day = Number(first); + const month = Number(second); + return { day, month, year,}; +} +console.log(parseDateString("MDY 10-21-1983")); +console.log(parseDateString("DMY 21-10-1983")); +console.log(parseDateString("MDY 03-15-2024")); +console.log(parseDateString("DMY 15-03-2024")); From 22fe46cf0e431b97caf5148b009c295a1f2b7181 Mon Sep 17 00:00:00 2001 From: Mustafa Homsi Date: Wed, 28 Jan 2026 09:39:51 +0100 Subject: [PATCH 3/4] w3 t3 done --- task-3/date.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 task-3/date.js diff --git a/task-3/date.js b/task-3/date.js new file mode 100644 index 0000000..a366451 --- /dev/null +++ b/task-3/date.js @@ -0,0 +1,18 @@ +export function convertHoursToMinutes(hours) { + return hours * 60; +} +export function convertMinutesToHours(minutes) { + return minutes / 60; +} +export function convertDaysToHours(days) { + return days * 24; +} +export function convertHoursToDays(hours) { + return hours / 24; +} +export function convertMinutesToSeconds(minutes) { + return minutes * 60; +} +export function convertSecondsToMinutes(seconds) { + return seconds / 60; +} \ No newline at end of file From 9a1ad6844a4aa50f6530657c59915bdada1b15c0 Mon Sep 17 00:00:00 2001 From: Mustafa Homsi Date: Wed, 28 Jan 2026 10:12:22 +0100 Subject: [PATCH 4/4] mustafa homsi --- task-4/cleanup.js | 113 +++++++++++++++++----------------------------- 1 file changed, 41 insertions(+), 72 deletions(-) diff --git a/task-4/cleanup.js b/task-4/cleanup.js index 207523a..6be450c 100644 --- a/task-4/cleanup.js +++ b/task-4/cleanup.js @@ -1,80 +1,49 @@ -// Temperature conversion and weather report for City 1 -let cityName1 = "Amsterdam"; -let tempCelsius1 = 22; -let tempFahrenheit1 = (tempCelsius1 * 9 / 5) + 32; -let tempKelvin1 = tempCelsius1 + 273.15; -console.log("Weather Report for " + cityName1); -console.log("Temperature: " + tempCelsius1 + "°C"); -console.log("Temperature: " + tempFahrenheit1 + "°F"); -console.log("Temperature: " + tempKelvin1 + "K"); -if (tempCelsius1 < 0) { - console.log("Status: Freezing"); -} else if (tempCelsius1 >= 0 && tempCelsius1 < 10) { - console.log("Status: Cold"); -} else if (tempCelsius1 >= 10 && tempCelsius1 < 20) { - console.log("Status: Mild"); -} else if (tempCelsius1 >= 20 && tempCelsius1 < 30) { - console.log("Status: Warm"); -} else { - console.log("Status: Hot"); + +function tempCelsiusToFahrenheit(tempCelsius) { + return (tempCelsius * 9 / 5) + 32; +} +function tempCelsiusToKelvin(tempCelsius) { + return tempCelsius + 273.15; } -console.log("---"); +function getTemperatureStatus(tempCelsius) { + if (tempCelsius < 0) return "Freezing"; + else if (tempCelsius >= 0 && tempCelsius < 10) return "Cold"; + else if (tempCelsius >= 10 && tempCelsius < 20) return "Mild"; + else if (tempCelsius >= 20 && tempCelsius < 30) return "Warm"; + return "Hot"; +} + + function printWeatherReport(city, tempCelsius) { + let tempFahrenheit = tempCelsiusToFahrenheit(tempCelsius); + let tempKelvin = tempCelsiusToKelvin(tempCelsius); + let status = getTemperatureStatus(tempCelsius); -// Temperature conversion and weather report for City 2 -let cityName2 = "Berlin"; -let tempCelsius2 = 15; -let tempFahrenheit2 = (tempCelsius2 * 9 / 5) + 32; -let tempKelvin2 = tempCelsius2 + 273.15; -console.log("Weather Report for " + cityName2); -console.log("Temperature: " + tempCelsius2 + "°C"); -console.log("Temperature: " + tempFahrenheit2 + "°F"); -console.log("Temperature: " + tempKelvin2 + "K"); -if (tempCelsius2 < 0) { - console.log("Status: Freezing"); -} else if (tempCelsius2 >= 0 && tempCelsius2 < 10) { - console.log("Status: Cold"); -} else if (tempCelsius2 >= 10 && tempCelsius2 < 20) { - console.log("Status: Mild"); -} else if (tempCelsius2 >= 20 && tempCelsius2 < 30) { - console.log("Status: Warm"); -} else { - console.log("Status: Hot"); + console.log("Weather Report for " + city); + console.log("Temperature: " + tempCelsius + "°C"); + console.log("Temperature: " + tempFahrenheit + "°F"); + console.log("Temperature: " + tempKelvin + "K"); + console.log("Status: " + status); + console.log("---"); + } + function calculateWindChill(tempCelsius, windSpeed) { + return ( + 13.12 + + 0.6215 * tempCelsius - + 11.37 * Math.pow(windSpeed, 0.16) + + 0.3965 * tempCelsius * Math.pow(windSpeed, 0.16) + ); } -console.log("---"); -// Temperature conversion and weather report for City 3 -let cityName3 = "Copenhagen"; -let tempCelsius3 = -5; -let tempFahrenheit3 = (tempCelsius3 * 9 / 5) + 32; -let tempKelvin3 = tempCelsius3 + 273.15; -console.log("Weather Report for " + cityName3); -console.log("Temperature: " + tempCelsius3 + "°C"); -console.log("Temperature: " + tempFahrenheit3 + "°F"); -console.log("Temperature: " + tempKelvin3 + "K"); -if (tempCelsius3 < 0) { - console.log("Status: Freezing"); -} else if (tempCelsius3 >= 0 && tempCelsius3 < 10) { - console.log("Status: Cold"); -} else if (tempCelsius3 >= 10 && tempCelsius3 < 20) { - console.log("Status: Mild"); -} else if (tempCelsius3 >= 20 && tempCelsius3 < 30) { - console.log("Status: Warm"); -} else { - console.log("Status: Hot"); +function printWindChill(city, tempCelsius, windSpeed) { + const windChill = calculateWindChill(tempCelsius, windSpeed); + console.log("Wind chill in " + city + ": " + windChill.toFixed(2) + "°C"); } -console.log("---"); +printWeatherReport("Amsterdam", 22); -// Wind chill calculation for City 1 -let windSpeed1 = 15; -let windChill1 = 13.12 + 0.6215 * tempCelsius1 - 11.37 * Math.pow(windSpeed1, 0.16) + 0.3965 * tempCelsius1 * Math.pow(windSpeed1, 0.16); -console.log("Wind chill in " + cityName1 + ": " + windChill1.toFixed(2) + "°C"); +printWeatherReport("berlin", 15); -// Wind chill calculation for City 2 -let windSpeed2 = 20; -let windChill2 = 13.12 + 0.6215 * tempCelsius2 - 11.37 * Math.pow(windSpeed2, 0.16) + 0.3965 * tempCelsius2 * Math.pow(windSpeed2, 0.16); -console.log("Wind chill in " + cityName2 + ": " + windChill2.toFixed(2) + "°C"); +printWeatherReport("Copenhagen", 5); -// Wind chill calculation for City 3 -let windSpeed3 = 25; -let windChill3 = 13.12 + 0.6215 * tempCelsius3 - 11.37 * Math.pow(windSpeed3, 0.16) + 0.3965 * tempCelsius3 * Math.pow(windSpeed3, 0.16); -console.log("Wind chill in " + cityName3 + ": " + windChill3.toFixed(2) + "°C"); \ No newline at end of file +printWindChill("Amsterdam", 22, 15); +printWindChill("Berlin", 15, 20); +printWindChill("Copenhagen", 5, 25); \ No newline at end of file