Skip to content
This repository was archived by the owner on Oct 26, 2020. It is now read-only.

Commit e68af98

Browse files
author
Chris Owen
authored
Merge pull request #40 from illicitonion/week1
Improvements to week1 exercises
2 parents aebc617 + 10901fd commit e68af98

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

week-1/2-mandatory/4-tax.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ function calculateSalesTax() {}
1212
===================
1313
The business has informed you that prices must have 2 decimal places
1414
They must also start with the currency symbol
15-
Write a function that transforms numbers into the format £0.00
15+
Write a function that adds tax to a number, and then transforms the total into the format £0.00
1616
1717
Remember that the prices must include the sales tax (hint: you already wrote a function for this!)
1818
*/
1919

20-
function formatCurrency() {}
20+
function addTaxAndFormatCurrency() {}
2121

2222
/* ======= TESTS - DO NOT MODIFY =====
2323
There are some Tests in this file that will help you work out if your code is working.
@@ -41,6 +41,6 @@ test("calculateSalesTax function - case 1 works", calculateSalesTax(15), 18)
4141
test("calculateSalesTax function - case 2 works", calculateSalesTax(17.5), 21)
4242
test("calculateSalesTax function - case 3 works", calculateSalesTax(34), 40.8)
4343

44-
test("formatCurrency function - case 1 works", formatCurrency(15), "£18.00")
45-
test("formatCurrency function - case 2 works", formatCurrency(17.5), "£21.00")
46-
test("formatCurrency function - case 3 works", formatCurrency(34), "£40.80")
44+
test("addTaxAndFormatCurrency function - case 1 works", addTaxAndFormatCurrency(15), "£18.00")
45+
test("addTaxAndFormatCurrency function - case 2 works", addTaxAndFormatCurrency(17.5), "£21.00")
46+
test("addTaxAndFormatCurrency function - case 3 works", addTaxAndFormatCurrency(34), "£40.80")

week-1/3-extra/3-magic-8-ball.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,17 @@ function testAll() {
9090
logged === "The ball has shaken!"
9191
);
9292
test(`shakeBall returns an string answer`, typeof answer === "string");
93+
94+
test(
95+
`checkAnswer("It is decidedly so.") returns "very positive`,
96+
checkAnswer("It is decidedly so.") === "very positive"
97+
)
98+
99+
test(
100+
`checkAnswer("My reply is no.") returns "very negative`,
101+
checkAnswer("My reply is no.") === "very negative"
102+
)
103+
93104
test(
94105
`checkAnswer returns the level of positivity"`,
95106
["very positive", "positive", "negative", "very negative"].includes(

0 commit comments

Comments
 (0)