From f4fda1e5c1a0a8991b9c4ed449cbfdd1aaeb5b40 Mon Sep 17 00:00:00 2001 From: Albawab <32767497+Albawab@users.noreply.github.com> Date: Tue, 28 May 2019 12:37:43 +0200 Subject: [PATCH 1/2] Update maartjes-work.js --- Week2/homework/maartjes-work.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Week2/homework/maartjes-work.js b/Week2/homework/maartjes-work.js index 49772eb44..9fd4fe355 100644 --- a/Week2/homework/maartjes-work.js +++ b/Week2/homework/maartjes-work.js @@ -47,7 +47,18 @@ const maartjesHourlyRate = 20; function computeEarnings(tasks, hourlyRate) { // Replace this comment and the next line with your code - console.log(tasks, hourlyRate); + const totalHourWork = tasks.map(min => min.duration).reduce((hour, min) => hour + min / 60, 0); + + const salary = totalHourWork * hourlyRate; + const doller = salary.toLocaleString('en-US', { + style: 'currency', + currency: 'USD', + }); + + console.log(totalHourWork * hourlyRate); + + console.log(doller); + return doller; } // eslint-disable-next-line no-unused-vars @@ -55,7 +66,7 @@ const earnings = computeEarnings(maartjesTasks, maartjesHourlyRate); // add code to convert `earnings` to a string rounded to two decimals (euro cents) -console.log(`Maartje has earned €${'replace this string with the earnings rounded to euro cents'}`); +console.log(`Maartje has earned €${earnings}`); // Do not change or remove anything below this line module.exports = { From dfbef8cd8adde02a054c7ce4af9aed786a698f65 Mon Sep 17 00:00:00 2001 From: Albawab <32767497+Albawab@users.noreply.github.com> Date: Tue, 28 May 2019 18:19:17 +0200 Subject: [PATCH 2/2] Delete maartjes-work.js --- Week2/homework/maartjes-work.js | 76 --------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 Week2/homework/maartjes-work.js diff --git a/Week2/homework/maartjes-work.js b/Week2/homework/maartjes-work.js deleted file mode 100644 index 9fd4fe355..000000000 --- a/Week2/homework/maartjes-work.js +++ /dev/null @@ -1,76 +0,0 @@ -'use strict'; - -const monday = [ - { - name: 'Write a summary HTML/CSS', - duration: 180, - }, - { - name: 'Some web development', - duration: 120, - }, - { - name: 'Fix homework for class10', - duration: 20, - }, - { - name: 'Talk to a lot of people', - duration: 200, - }, -]; - -const tuesday = [ - { - name: 'Keep writing summary', - duration: 240, - }, - { - name: 'Some more web development', - duration: 180, - }, - { - name: 'Staring out the window', - duration: 10, - }, - { - name: 'Talk to a lot of people', - duration: 200, - }, - { - name: 'Look at application assignments new students', - duration: 40, - }, -]; - -const maartjesTasks = monday.concat(tuesday); -const maartjesHourlyRate = 20; - -function computeEarnings(tasks, hourlyRate) { - // Replace this comment and the next line with your code - const totalHourWork = tasks.map(min => min.duration).reduce((hour, min) => hour + min / 60, 0); - - const salary = totalHourWork * hourlyRate; - const doller = salary.toLocaleString('en-US', { - style: 'currency', - currency: 'USD', - }); - - console.log(totalHourWork * hourlyRate); - - console.log(doller); - return doller; -} - -// eslint-disable-next-line no-unused-vars -const earnings = computeEarnings(maartjesTasks, maartjesHourlyRate); - -// add code to convert `earnings` to a string rounded to two decimals (euro cents) - -console.log(`Maartje has earned €${earnings}`); - -// Do not change or remove anything below this line -module.exports = { - maartjesTasks, - maartjesHourlyRate, - computeEarnings, -};