+ 1

Currency Converter

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

8th Jan 2021, 2:11 PM
Priya Ghosh
Priya Ghosh - avatar
82 Réponses
+ 46
Hey there! Priya Ghosh This is the solution for the python code: function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); console.log(convert(amount, rate)); } function convert(amount,rate){ return amount * rate }
9th Jan 2021, 4:58 AM
anvesha
+ 22
function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); function convert(amount, rate) { return amount*rate; } console.log(convert(amount, rate)); }
14th Mar 2021, 10:46 PM
Kevin Alexander Alvarez Echeverri
Kevin Alexander Alvarez Echeverri - avatar
+ 7
function main() { var amount = parseFloat(readline(),10); var rate = parseFloat(readLine(),10); console.log(convert(amount, rate)); function convert (amount, rate){ var result = amount * rate; return result; } }
6th Jun 2021, 12:13 PM
sarah
sarah - avatar
+ 4
//Here is my Solution function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); function convert (a,b){ return amount*rate; } convert(); console.log(convert(amount, rate)); } If I'm right its simply Multiply the given amount with the set rate and returns the product.
17th Jul 2022, 12:49 AM
Fahad Nawaz
Fahad Nawaz - avatar
+ 3
@Caleb can you help me ? Arrays The array you are given represents the menu of breakfast options available at the hotel. The Chef decided to replace one of the options with "Fluffy Pancakes". Write a program to take the index as input, replace the element with that index with "Fluffy Pancakes", and output the new menu to the console as an array. Sample Input 2 Sample Output [ 'Cinnamon Doughnuts', 'Waffles', 'Fluffy Pancakes', 'Chorizo Burrito', 'French Toast' ] The element with index 2 has been replaced in the output array. this question. and my code is - function main() { var breakfasts = ['Cinnamon Doughnuts', 'Waffles', 'Fluffy Pancakes', 'Chorizo Burrito', 'French Toast']; var index = parseInt(readLine(), 10) //replace the corresponding element by "Fluffy Pancakes" //output the menu to the console document.write(breakfasts[2]); } but getting error.
12th Jan 2021, 8:29 AM
Priya Ghosh
Priya Ghosh - avatar
+ 2
function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); function convert (a,b){ var c = a * b; return c } console.log(convert(amount, rate)); }
7th May 2021, 1:25 PM
Alharith Yousif
Alharith Yousif - avatar
+ 2
function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); console.log(convert(amount, rate)); function convert(amount, rate){ return amount*rate } convert() }
30th Nov 2021, 12:05 PM
Aziz Diallo
Aziz Diallo - avatar
+ 2
Hey guys , this is the simplest approach to the solution function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); console.log(convert(amount, rate)); } function convert(amount,rate){ return amount * rate }
5th Apr 2022, 12:32 PM
Solahudeen Abdulrahmon
Solahudeen Abdulrahmon - avatar
+ 2
you can try this function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); function convert(amount,rate){ return amount*rate; } console.log(convert(amount, rate)); }
24th Jan 2023, 8:38 AM
Abenzer Adugna
+ 1
No I couldn't solve this . Can you solve this ? It will help me a lot.
8th Jan 2021, 2:59 PM
Priya Ghosh
Priya Ghosh - avatar
+ 1
function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); console.log(convert(amount, rate)); } you start with this and if you change the: console.log(convert(amount, rate)); to make it rate times amount it works
8th Jan 2021, 3:05 PM
Brain & Bones
Brain & Bones - avatar
+ 1
No I can't understand. can you showcase me the complete code?
8th Jan 2021, 3:19 PM
Priya Ghosh
Priya Ghosh - avatar
+ 1
Caleb It's not solving.
8th Jan 2021, 3:22 PM
Priya Ghosh
Priya Ghosh - avatar
+ 1
Priya Ghosh wow!! you took me way too literally. i was trying to lead you to this: function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); console.log(rate * amount); }
8th Jan 2021, 3:40 PM
Brain & Bones
Brain & Bones - avatar
+ 1
function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); console.log(amount * rate); }
4th Sep 2021, 1:01 PM
PRO programmer
PRO programmer - avatar
+ 1
add this function convert(amount,rate){ return amount * rate }
26th Apr 2022, 5:50 PM
Amit Kumar Mishra
+ 1
function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); console.log(convert(amount, rate)); } function convert(amount,rate){ c = amount*rate return c }
2nd Jul 2022, 12:50 AM
Ankit Rauniyar
Ankit Rauniyar - avatar
0
you're attempt?
8th Jan 2021, 2:20 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
0
Caleb lemme try once will let you know.
8th Jan 2021, 3:15 PM
Priya Ghosh
Priya Ghosh - avatar
0
Showing error. caleb can we connect on any social media ??? Please .
8th Jan 2021, 3:29 PM
Priya Ghosh
Priya Ghosh - avatar