+ 1

currency convert

Please assist I want to write a program that'Ll prompt user to enter 0 to conver from usd to rmb. And 1 to convert from rmb to usd Like this Enter exchange rate from $ to rmb-6.81 Enter 0 to convert usd-rmb and 1 vice versa Enter dollar amount-$100 $100 is 681.0yuan Enter the exchange rate from $-rmb-Enter 0 to convert usd-rmb and 1 vice versa Enter the rmb amount-10000 10000yuan is $1468.43

22nd Aug 2017, 1:14 PM
abejide femi
8 Respuestas
+ 2
Thanks for the assist 🙏🏽
23rd Aug 2017, 7:00 PM
abejide femi
+ 1
Var rate=prompt('enter rate from dollar to RMB') var ratecon=prompt('enter 0 to convert dollars to RMB and 1 vice Versa') If(ratecon==0){ var amountdol=prompt("enter the dollar amount") } If (ratecon==1){ Var amountRmb=prompt('enter the RMB amount') }
23rd Aug 2017, 3:28 PM
abejide femi
+ 1
Thanks, it's a java excercise tho, just trying to solve with JavaScript
23rd Aug 2017, 6:54 PM
abejide femi
+ 1
function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); function convert(amount , rate){ var p = amount*rate; return p; } console.log(convert(amount, rate)); } This the answer .
27th Aug 2021, 11:47 AM
Ehsan Safari
Ehsan Safari - avatar
0
Is easier, with some prompts, operations and variables, try and show us ;-)
22nd Aug 2017, 10:39 PM
Daniel
Daniel - avatar
0
What I've tried so far, need more clues please
23rd Aug 2017, 3:29 PM
abejide femi
0
https://code.sololearn.com/WJH6cK56CJRX/?ref=app Check it and write feedback. You needed operations because use PROMPTS and VARIABLES. Anyway, I tried to follow your way to code but you can simplify that code enterely or change that to do better and even with graphical interface. Remember Abejide, it's not difficult, is something easier, you only need to do more and more in each step and of course, ask to others and researching by the Internet
23rd Aug 2017, 6:21 PM
Daniel
Daniel - avatar
0
Java is not javascript
23rd Aug 2017, 7:00 PM
Daniel
Daniel - avatar