Skip to content
Merged
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
13 changes: 13 additions & 0 deletions DateAndTime/todo_dayfunction.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<html>
<head>
<title>Date To Do</title>
</head>

<body>
To Do List:

<ul>
<li>Find a better way than the long switch statement</li>
</ul>
</body>
</html>
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@
The point is to practice, practice, practice. Get the 10,000 hours in. The only way to Get Good is to make 1000 things and make mistakes.

# How?
The plan is to study a range of courses and tutorials, which I'll list, then build things. Those things might be simple classes or objects, arrays and case statements, they might be small utilities or features that could be added to something bigger, they might even be the big things themselves. We'll see how this goes.
The plan is to study a range of courses and tutorials, which I'll list at the bottom of this Readme, then build things. Those things might be simple classes or objects, arrays and case statements, they might be small utilities or features that could be added to something bigger, they might even be the big things themselves. We'll see how this goes.

# When?
Whenever I can over the coming months. If I do 1 thing per day then building 1000 things will take 2.7 years - so settle in...

# Contributing
If there's anything that you think could be improved due to misunderstanding, then let me know.

# The 1000 Things
*folder > main js file*
1. Date and Time > myDayFunction.js
2. Date and Time > myYearAndDate.js
3. VAT Calculator > vat-script.js

# Courses and Sources
**[https://www.sololearn.com/Course/JavaScript/](https://www.sololearn.com/Course/JavaScript/)**
Pretty good intro, some content has been reworked in a confusing manner, so feel free to cheat and read the comments for the answers.

# The 1000 Things
Date and Time >
1. myDayFunction.js
2. myYearAndDate.js
Pretty good intro, some content has been reworked in a confusing manner, so feel free to cheat and read the comments for the answers.
41 changes: 41 additions & 0 deletions VATCalculator/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<html>
<head>
<title>VAT Calculator</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>

<body>
<div class="title"><p>Remove VAT from an amount you have</p></div>
<div>
<input type="number" value="0.00">
<button type="button">Remove VAT</button>
</div>
<div class="removed">
<p>
Gross: £0.00<br>
Net: £0.00<br>
VAT: £0.00
</p>
</div>

<div><hr></div>

<div class="title"><p>Add VAT onto an amount to get the total cost</p></div>
<div>
<input type="number" value="0.00">
<button type="button">Add VAT</button>
</div>
<div class="added">
<p>
Gross: £0.00<br>
Net: £0.00<br>
VAT: £0.00
</p>
</div>

<script src="vat-script.js"></script>

<a href="todo_vat.html" target="_blank">To do</a>

</body>
</html>
2 changes: 2 additions & 0 deletions VATCalculator/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/* main styles */
body { padding:0; margin:10; vertical-align:top; background:#ffffff; font-family:Tahoma;}
16 changes: 16 additions & 0 deletions VATCalculator/todo_vat.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<html>
<head>
<title>VAT To Do</title>
</head>

<body>
To Do List:

<ul>
<li>Sliding element to set VAT amount setting</li>
<li>Change button to read [start again] then reload the page</li>
<li>Prior calculations placed in a horizontal table</li>

</ul>
</body>
</html>
33 changes: 33 additions & 0 deletions VATCalculator/vat-script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const button = document.querySelectorAll("button");
const added = document.querySelector(".added");
const removed = document.querySelector(".removed");

button[0].addEventListener("click",function(){
const cost = document.querySelectorAll("input")[0];

let grossAmount = ((cost.value - 1)+1).toFixed(2);
let netAmount = (grossAmount / 1.2).toFixed(2);
let removedVatAmount = (grossAmount - netAmount).toFixed(2);

let resultRemove = `<p>
Gross: £${grossAmount}</br>
Net: £${netAmount}</br>
VAT: £${removedVatAmount}</p>`;

removed.innerHTML = resultRemove;
})

button[1].addEventListener("click",function(){
const costAdd = document.querySelectorAll("input")[1];

let grossAmountAdd = ((costAdd.value - 1)+1).toFixed(2);
let netAmountAdd = (grossAmountAdd * 1.2).toFixed(2);
let vatAmountAdd = (netAmountAdd - grossAmountAdd).toFixed(2);

let resultAdd = `<p>
Gross: £${grossAmountAdd}</br>
Net: £${netAmountAdd}</br>
VAT: £${vatAmountAdd}</p>`;

added.innerHTML = resultAdd;
})