Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 118 additions & 6 deletions Week1/homework/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,123 @@
'use strict';

{
const bookTitles = [
// Replace with your own book titles
'harry_potter_chamber_secrets'
];
function main() {
const listBooks = [
'id_book_one',
'id_book_two',
'id_book_three',
'id_book_four',
'id_book_five',
'id_book_six',
'id_book_seven',
'id_book_eight',
'id_book_nine',
'id_book_ten'
];

// Replace with your own code
console.log(bookTitles);
const information = {
id_book_one: {
author: 'Kevin Brockmeier',
language: 'english',
name: 'The Brief History of the Dead',
Artist: 'Archie Ferguson'
},
id_book_two: {
author: 'Bret Easton Ellis',
language: 'english',
name: ' American Psycho',
Artist: 'Marshall Arisman'
},
id_book_three: {
author: 'Jon Ronson',
language: 'english',
name: 'Columbine',
Artist: 'Henry Sene Yee'
},
id_book_four: {
author: 'Jon Ronson',
language: 'english',
name: 'The Psychopath Test',
Artist: 'Alex Merto'
},
id_book_five: {
author: 'Albert Camus',
language: 'english',
name: 'The Stranger',
Artist: 'Helen Yentus'
},
id_book_six: {
author: 'The Road',
language: 'english',
name: 'The Road',
Artist: 'Nick Lowndes'
},
id_book_seven: {
author: 'Jim Th',
language: 'english',
name: 'Heed The Thunder',
Artist: 'Unknown'
},
id_book_eight: {
author: 'James Hawes',
language: 'english',
name: 'You Should Read',
Artist: 'Steve Snider'
},
id_book_nine: {
author: 'The Humbling',
language: 'english',
name: 'The Humbling',
Artist: 'Milton Glaser'
},
id_book_ten: {
author: 'F. Scott Fitzgerald',
language: 'english',
name: 'he Great Gatsby',
Artist: 'Unknown'
}
};
const image = {
id_book_one: './image/id_book_one.jpg',
id_book_two: './image/id_book_two.jpg',
id_book_three: './image/id_book_three.jpg',
id_book_four: './image/id_book_four.jpg',
id_book_five: './image/id_book_five.jpg',
id_book_six: './image/id_book_six.jpg',
id_book_seven: './image/id_book_seven.jpg',
id_book_eight: './image/id_book_eight.jpg',
id_book_nine: './image/id_book_nine.jpg',
id_book_ten: './image/id_book_ten.jpg'
};
const div = document.getElementById('container');

const h1Tag = document.createElement('h1');
h1Tag.innerHTML = 'My Favourite Books';
div.appendChild(h1Tag);
h1Tag.className = 'h1Tag';

const divTag = document.createElement('div');
divTag.className = 'myBooks';

const ulTag = document.createElement('ul');
ulTag.className = 'books';
listBooks.forEach(function(id) {
const img = document.createElement('img');
img.src = image[id];
img.className = 'cover';
const title = document.createElement('h2');
title.innerHTML = information[id].name;
title.className = 'title';
const liTag = document.createElement('li');
liTag.innerHTML = information[id].author;
liTag.className = 'book';
liTag.appendChild(title);
liTag.appendChild(img);
ulTag.appendChild(liTag);
div.appendChild(divTag);
divTag.appendChild(ulTag);
});
}

window.addEventListener('load', main);
}
Binary file added Week1/homework/image/id_book_eight.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/homework/image/id_book_five.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/homework/image/id_book_four.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/homework/image/id_book_nine.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/homework/image/id_book_one.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/homework/image/id_book_seven.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/homework/image/id_book_six.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/homework/image/id_book_ten.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/homework/image/id_book_three.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Week1/homework/image/id_book_two.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 14 additions & 1 deletion Week1/homework/index.html
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
<!-- replace this with your HTML content -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" type="text/css" media="screen" href="style.css" />
<script src="app.js"></script>
</head>
<body>
<div id="container"></div>
</body>
</html>
32 changes: 31 additions & 1 deletion Week1/homework/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
/* add your styling here */
body {
background-image: url('http://celb.lu/wp-content/uploads/2014/04/Gray-plain-website-background.jpg');
width: 100%;
}
ul {
text-decoration-style: none;
display: flex;
justify-content: center;
flex-wrap: wrap;
}

li {
list-style: none;
margin-top: 0px;
width: 300px;
height: 400px;
vertical-align: middle;
}
h1 {
text-align: center;
color: rgb(29, 124, 168);
font-size: 5em;
}
img {
width: 150px;
height: 200px;
border-radius: 30px;
}
.book {
margin: 30px 10px 5px 20px;
}
11 changes: 8 additions & 3 deletions Week2/homework/maartjes-work.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,21 @@ 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);
const totalEarning = tasks
console.log(tasks, hourlyRate); .map(x => x.duration / 60)
.filter(x => x >= 2)
.map(x => x * hourlyRate)
.reduce((accumulator, number) => accumulator + number);
return totalEarning;

}

// 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 = {
Expand Down
3 changes: 1 addition & 2 deletions Week2/homework/map-filter.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use strict';

function doubleOddNumbers(numbers) {
// Replace this comment and the next line with your code
console.log(numbers);
return numbers.filter(x => x % 2 !== 0).map(x => x * 2);
}

const myNumbers = [1, 2, 3, 4];
Expand Down