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

Commit f04cfa5

Browse files
committed
3-extra>1-currency-conversion is done
1 parent bc62e64 commit f04cfa5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

week-1/3-extra/1-currency-conversion.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
Write a function that converts a price to USD (exchange rate is 1.4 $ to £)
66
*/
77

8-
function convertToUSD() {}
8+
function convertToUSD(price) {
9+
let convertToUs=1.4*price;;
10+
return convertToUs;
11+
}
912

1013
/*
1114
CURRENCY FORMATTING
@@ -16,7 +19,12 @@ function convertToUSD() {}
1619
Find a way to add 1% to all currency conversions (think about the DRY principle)
1720
*/
1821

19-
function convertToBRL() {}
22+
function convertToBRL(price) {
23+
let percentOfPrice=(1/100)*(5.7*price);
24+
let convertToBrazil=5.7*price;
25+
let total=percentOfPrice+convertToBrazil;
26+
return total;
27+
}
2028

2129
/* ======= TESTS - DO NOT MODIFY =====
2230
There are some Tests in this file that will help you work out if your code is working.

0 commit comments

Comments
 (0)