+ 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
8 odpowiedzi
+ 2
Thanks for the assist 🙏🏽
+ 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')
}
+ 1
Thanks, it's a java excercise tho, just trying to solve with JavaScript
+ 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 .
0
Is easier, with some prompts, operations and variables, try and show us ;-)
0
What I've tried so far, need more clues please
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
0
Java is not javascript