diff --git a/Week1/homework/app.js b/Week1/homework/app.js deleted file mode 100644 index 6131f54ea..000000000 --- a/Week1/homework/app.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -{ - const bookTitles = [ - // Replace with your own book titles - 'harry_potter_chamber_secrets' - ]; - - // Replace with your own code - console.log(bookTitles); -} diff --git a/Week1/homework/css/style.css b/Week1/homework/css/style.css new file mode 100644 index 000000000..1ccad700a --- /dev/null +++ b/Week1/homework/css/style.css @@ -0,0 +1,50 @@ +*{ + box-sizing: border-box; +} +body{ + background: lightgrey; + margin: 0 auto; + text-align:center; +} +#myList{ + width: 80%; + margin: 0 auto; + text-align:center; +} +ol{ + display: flex; + flex-wrap:wrap; + margin: 0 auto; + width: 100%; +} +li{ + background-color: #0a0a0a; + margin: 1%; + padding: 1%; + width:31.333%; + border-radius:10px; + text-align:center; + list-style: none; +} +img{ + width:90% +} +h2{ + background-color:#4c4643 ; + color: #ffffff; + font-size: 100%; + font-family:cursive; + margin: 1%; +} +h3{ + color: #ffffff; + font-size: 80%; + font-family:monospace; + margin: 1%; +} +p{ + color: #ffffff; + font-size: 70%; + font-family:sans-serif; + margin: 1%; +} diff --git a/Week1/homework/img/Blindness.jpg b/Week1/homework/img/Blindness.jpg new file mode 100644 index 000000000..b4f036c6e Binary files /dev/null and b/Week1/homework/img/Blindness.jpg differ diff --git a/Week1/homework/img/Thumbs.db b/Week1/homework/img/Thumbs.db new file mode 100644 index 000000000..643318bc3 Binary files /dev/null and b/Week1/homework/img/Thumbs.db differ diff --git a/Week1/homework/img/angels_and_demons.jpg b/Week1/homework/img/angels_and_demons.jpg new file mode 100644 index 000000000..55e74bf27 Binary files /dev/null and b/Week1/homework/img/angels_and_demons.jpg differ diff --git a/Week1/homework/img/crime_and_punishment.jpg b/Week1/homework/img/crime_and_punishment.jpg new file mode 100644 index 000000000..37ac14237 Binary files /dev/null and b/Week1/homework/img/crime_and_punishment.jpg differ diff --git a/Week1/homework/img/do_not_tell_mommy.jpg b/Week1/homework/img/do_not_tell_mommy.jpg new file mode 100644 index 000000000..9de003aa1 Binary files /dev/null and b/Week1/homework/img/do_not_tell_mommy.jpg differ diff --git a/Week1/homework/img/inferno.jpg b/Week1/homework/img/inferno.jpg new file mode 100644 index 000000000..2f68ba35b Binary files /dev/null and b/Week1/homework/img/inferno.jpg differ diff --git a/Week1/homework/img/les_miserables.jpg b/Week1/homework/img/les_miserables.jpg new file mode 100644 index 000000000..18a9280c1 Binary files /dev/null and b/Week1/homework/img/les_miserables.jpg differ diff --git a/Week1/homework/img/the_bamboo_stalk.jpg b/Week1/homework/img/the_bamboo_stalk.jpg new file mode 100644 index 000000000..ca8543219 Binary files /dev/null and b/Week1/homework/img/the_bamboo_stalk.jpg differ diff --git a/Week1/homework/img/the_davinci_code.jpg b/Week1/homework/img/the_davinci_code.jpg new file mode 100644 index 000000000..1816c60a7 Binary files /dev/null and b/Week1/homework/img/the_davinci_code.jpg differ diff --git a/Week1/homework/img/the_kite_runner.jpg b/Week1/homework/img/the_kite_runner.jpg new file mode 100644 index 000000000..dd959e210 Binary files /dev/null and b/Week1/homework/img/the_kite_runner.jpg differ diff --git a/Week1/homework/img/the_monk_who_sold_his_ferrari.jpg b/Week1/homework/img/the_monk_who_sold_his_ferrari.jpg new file mode 100644 index 000000000..9901a9d9d Binary files /dev/null and b/Week1/homework/img/the_monk_who_sold_his_ferrari.jpg differ diff --git a/Week1/homework/index.html b/Week1/homework/index.html index b22147cd1..a53eaeb81 100644 --- a/Week1/homework/index.html +++ b/Week1/homework/index.html @@ -1 +1,15 @@ - \ No newline at end of file + + + + + Codestin Search App + + + + + + +
+ + + \ No newline at end of file diff --git a/Week1/homework/js/my_book.js b/Week1/homework/js/my_book.js new file mode 100644 index 000000000..affb3296c --- /dev/null +++ b/Week1/homework/js/my_book.js @@ -0,0 +1,82 @@ +/*global console*/ +'use strict'; + +var namesBook = [ + 'the_davinci_code', + 'the_kite_runner', + 'the_bamboo_stalk', + 'do_not_tell_mommy', + 'inferno', + 'angels_and_demons', + 'les_miserables', + 'crime_and_punishment', + 'blindness', + 'the_monk_who_sold_his_ferrari' +]; +var ownerBook = [ + 'Dan Brown', + 'Khaled Hosseini', + 'Saud Alsanousi', + 'Toni Maguire', + 'Dan Brown', + 'Dan Brown', + 'Victor Hugo', + 'Fyodor Dostoevsky', + 'José Saramago', + 'Robin Sharma' + ], + titleBook = [ + 'The Davinci Code', + 'The Kite Runner', + 'The Bamboo Stalk ', + 'Don\'t Tell Mommy', + 'inferno', + 'Angels And Demons', + 'les miserables', + 'Crime And Punishment', + 'Blindness', + 'The monk who sold his ferrari' + ]; +var i; +var myOl = document.createElement('ol'); +document.getElementById('myList').appendChild(myOl); + +namesBook.forEach(function() { + + var myNewLi = document.createElement('li'); + myOl.appendChild(myNewLi); + myNewLi.setAttribute('id', 'li' + i); +}); + +var myId = namesBook, + auth = ownerBook, + tit = titleBook, + ob = { + idBook: myId, + title: tit, + author: auth, + language: 'English' + }; + +for (i = 0; i < ownerBook.length; i = i + 1) { + var myH = document.createElement('h2'); + var myNewLi = document.getElementsByTagName('li'); + myNewLi[i].appendChild(myH); + myH.textContent = titleBook[i]; + + var myOtherH = document.createElement('h3'); + var myNewLi = document.getElementsByTagName('li'); + myNewLi[i].appendChild(myOtherH); + myOtherH.textContent = 'By : ' + ownerBook[i]; + + var myp = document.createElement('p'); + var myNewLi = document.getElementsByTagName('li'); + myNewLi[i].appendChild(myp); + myp.textContent = 'the language : ' + ob.language; + + var myImg = document.createElement('img'); + var myNewLi = document.getElementsByTagName('li'); + myNewLi[i].appendChild(myImg); + myImg.setAttribute('src', 'img/' + namesBook[i] + '.jpg'); + myImg.setAttribute('alt', 'Here is the picture'); +} diff --git a/Week1/homework/style.css b/Week1/homework/style.css deleted file mode 100644 index bab13ec23..000000000 --- a/Week1/homework/style.css +++ /dev/null @@ -1 +0,0 @@ -/* add your styling here */ \ No newline at end of file diff --git a/Week2/homework/maartjes-work.js b/Week2/homework/maartjes-work.js index fc8c0e633..1c9ba1fbe 100644 --- a/Week2/homework/maartjes-work.js +++ b/Week2/homework/maartjes-work.js @@ -46,16 +46,25 @@ const maartjesTasks = monday.concat(tuesday); const maartjesHourlyRate = 20; function computeEarnings(tasks, hourlyRate) { - // Replace this comment and the next line with your code console.log(tasks, hourlyRate); } +return tasks +.map( hour => hour.duration / 60) +.filter(hour => hour >= 2) +.map (hour => hour * hourlyRate) +.reduce ((x, y) => x + y, 0); + + + + + // 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 €${'replace this string with the earnings rounded to euro cents'}`); +console.log(`Maartje has earned €${earnings.toFixed(2)}`); // Do not change or remove anything below this line module.exports = { diff --git a/Week2/homework/map-filter.js b/Week2/homework/map-filter.js index ab3c622d4..8cd94e36f 100644 --- a/Week2/homework/map-filter.js +++ b/Week2/homework/map-filter.js @@ -1,8 +1,8 @@ 'use strict'; function doubleOddNumbers(numbers) { - // Replace this comment and the next line with your code - console.log(numbers); + numbers = numbers.filter(x => x % 2).map(x => x * 2); + return numbers; } const myNumbers = [1, 2, 3, 4]; @@ -12,4 +12,4 @@ console.log(doubleOddNumbers(myNumbers)); module.exports = { myNumbers, doubleOddNumbers -}; +}; \ No newline at end of file