diff --git a/DateAndTime/todo_dayfunction.html b/DateAndTime/todo_dayfunction.html new file mode 100644 index 0000000..79e19b1 --- /dev/null +++ b/DateAndTime/todo_dayfunction.html @@ -0,0 +1,13 @@ + + + Date To Do + + + + To Do List: + + + + \ No newline at end of file diff --git a/README.md b/README.md index 371bc41..1c2ae0e 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ 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... @@ -13,11 +13,12 @@ Whenever I can over the coming months. If I do 1 thing per day then building 100 # 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 \ No newline at end of file +Pretty good intro, some content has been reworked in a confusing manner, so feel free to cheat and read the comments for the answers. \ No newline at end of file diff --git a/VATCalculator/index.html b/VATCalculator/index.html new file mode 100644 index 0000000..21b8951 --- /dev/null +++ b/VATCalculator/index.html @@ -0,0 +1,41 @@ + + + VAT Calculator + + + + +

Remove VAT from an amount you have

+
+ + +
+
+

+ Gross: £0.00
+ Net: £0.00
+ VAT: £0.00 +

+
+ +

+ +

Add VAT onto an amount to get the total cost

+
+ + +
+
+

+ Gross: £0.00
+ Net: £0.00
+ VAT: £0.00 +

+
+ + + + To do + + + \ No newline at end of file diff --git a/VATCalculator/style.css b/VATCalculator/style.css new file mode 100644 index 0000000..a174e44 --- /dev/null +++ b/VATCalculator/style.css @@ -0,0 +1,2 @@ +/* main styles */ +body { padding:0; margin:10; vertical-align:top; background:#ffffff; font-family:Tahoma;} \ No newline at end of file diff --git a/VATCalculator/todo_vat.html b/VATCalculator/todo_vat.html new file mode 100644 index 0000000..9ee5062 --- /dev/null +++ b/VATCalculator/todo_vat.html @@ -0,0 +1,16 @@ + + + VAT To Do + + + + To Do List: + + + + \ No newline at end of file diff --git a/VATCalculator/vat-script.js b/VATCalculator/vat-script.js new file mode 100644 index 0000000..ef929b9 --- /dev/null +++ b/VATCalculator/vat-script.js @@ -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 = `

+ Gross: £${grossAmount}
+ Net: £${netAmount}
+ VAT: £${removedVatAmount}

`; + + 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 = `

+ Gross: £${grossAmountAdd}
+ Net: £${netAmountAdd}
+ VAT: £${vatAmountAdd}

`; + + added.innerHTML = resultAdd; +}) \ No newline at end of file