Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit 8e99b84

Browse files
authored
Add files via upload
1 parent 749eb8f commit 8e99b84

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

Week2/homework/maartjes-work.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
'use strict';
2+
3+
const monday = [{
4+
name: 'Write a summary HTML/CSS',
5+
duration: 180
6+
},
7+
{
8+
name: 'Some web development',
9+
duration: 120
10+
},
11+
{
12+
name: 'Fix homework for class10',
13+
duration: 20
14+
},
15+
{
16+
name: 'Talk to a lot of people',
17+
duration: 200
18+
}
19+
];
20+
21+
const tuesday = [{
22+
name: 'Keep writing summary',
23+
duration: 240
24+
},
25+
{
26+
name: 'Some more web development',
27+
duration: 180
28+
},
29+
{
30+
name: 'Staring out the window',
31+
duration: 10
32+
},
33+
{
34+
name: 'Talk to a lot of people',
35+
duration: 200
36+
},
37+
{
38+
name: 'Look at application assignments new students',
39+
duration: 40
40+
}
41+
];
42+
43+
const maartjesTasks = monday.concat(tuesday);
44+
// eslint-disable-next-line no-unused-vars
45+
const maartjesHourlyRate = 20;
46+
47+
// Map the tasks to durations in hours.
48+
const tasksInHour = maartjesTasks.map(tasks => tasks.duration / 60);
49+
50+
// Filter out everything that took less than two hours
51+
const longTasks = tasksInHour.filter(task => task >= 2);
52+
53+
// Multiply the each duration by a per-hour rate for billing (use €20/hour) and sum it all up
54+
const profits = longTasks.map(task => task * 20);
55+
56+
let totalProfit = 0;
57+
profits.forEach(function (profit) {
58+
totalProfit += profit;
59+
});
60+
61+
// Output a formatted Euro amount, rounded to Euro cents, e.g: €11.34
62+
const roundedTotalProfit = totalProfit.toFixed(2);
63+
64+
// add code to convert `earnings` to a string rounded to two decimals (euro cents)
65+
console.log(`Maartje has earned €${roundedTotalProfit}`);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy