HELP WRITE CURRENCY CONVERTER | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
- 1

HELP WRITE CURRENCY CONVERTER

HELP You are making a currency converter app. Create a function called convert, which takes two parameters: the amount to convert, and the rate, and returns the resulting amount. The code to take the parameters as input and call the function is already present in the Playground. Create the function to make the code work. Sample Input: 100 1.1 Sample Output: 110 function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); var convert = rate * amount; console.log(convert(amount, rate)); }

1st Mar 2021, 2:13 AM
ŠšŠ°Š½Š“ыŠ±Š°ŠµŠ² ŠŠ»ŠøшŠµŃ€
ŠšŠ°Š½Š“ыŠ±Š°ŠµŠ² ŠŠ»ŠøшŠµŃ€ - avatar
4 Respostas
0
function convert(amount, rate) { return amount * rate; }
1st Mar 2021, 2:35 AM
TomĆ”s CL šŸ‡ØšŸ‡ŗ (temporarily inactive)
TomĆ”s CL šŸ‡ØšŸ‡ŗ (temporarily inactive) - avatar
+ 2
https://www.sololearn.com/Discuss/2710591/?ref=app you must define a function 'convert', not a variable... or at least just output 'convert' variable value ;)
1st Mar 2021, 2:31 AM
visph
visph - avatar
+ 2
TomƔs Corrales Lemoine what are you trying to do? you just got a best answer mark for the same question/OP, while you just spoil the problem, as he should implement at least the basics to start learning ^^
1st Mar 2021, 2:43 AM
visph
visph - avatar
+ 1
function convert(amount){ return amount * rate; }
20th Jul 2021, 10:13 AM
Adedeji Moyinoluwa
Adedeji Moyinoluwa - avatar