-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
58 lines (49 loc) · 2.17 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Reading a Book</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Reading a Book</h1>
<img class="book-image" src="book.jpg" alt="book">
<p>Reading a book is not a task or chore; it is a delightful journey. Take your time to dive deep into the narrative. This will help you understand how long it might take to finish a book.</p>
<li>A book or novel contains, on average, 60,000 to 100,000 words.</li>
<li>An average reader reads between 200 and 250 words per minute. </li>
<li> You can complete a book in 4 to 8 hours.</li><br>
<label for="wordCount">Enter the word count of the book:</label><br>
<input type="number" id="wordCount"><br>
<label for="readerType">Select your reading speed:</label><br>
<select class="options" id="readerType">
<option value="average">Average Reader</option>
<option value="good">Good Reader</option>
<option value="expert">Expert Reader</option>
</select><br>
<button onclick="calculateTime()">Calculate</button>
<p id="result"></p>
<script>
function calculateTime() {
// Get user input
const wordCount = document.getElementById('wordCount').value;
const readerType = document.getElementById('readerType').value;
// Define reading speeds in words per minute
const speeds = {
average: 250,
good: 300,
expert: 350
};
// Calculate reading time in minutes
const readingTimeInMinutes = wordCount / speeds[readerType];
// Convert minutes to hours and minutes
const hours = Math.floor(readingTimeInMinutes / 60);
const minutes = Math.round(readingTimeInMinutes % 60);
// Display the result
const resultElement = document.getElementById('result');
resultElement.textContent = `It will take approximately ${hours} hours and ${minutes} minutes to finish the book.`;
}
</script>
</body>
<footer>© 2023 All rights reserved to Dev Samson Karatapu</footer>
</html>