Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   CurrencyConverter help! (http://www.go4expert.com/forums/currencyconverter-help-t26993/)

ai5uzu 22Oct2011 00:09

CurrencyConverter help!
I have this one assignment in class and it's suppose to loop the conversion until I tell it to stop by entering in Q. I tried to do an if statement before the while but it didn't seem to work. Please help

Task: Write a program CurrencyConverter hat asks the user to enter today's price of one dollar in euro. Then the program reads US dollars vales and ocnverts each to euro values. Stop when the user enters Q.


import java.util.Scanner;
publicclass CurrencyConverter2
publicstaticvoid main(String args[])
privatedouble UsdToEuro;
privatedouble convertToEuro;
privatedouble dollars;
boolean stop = false;
while (!stop)
System.out.print("Enter today's price of 1 dollar in euro, Q to Quit: "); // Today's exchange rate is .72427
UsdToEuro = scan.nextDouble();
System.out.println("You entered today's USD to Euro exchange rate is: " + UsdToEuro);
System.out.print("Enter USD value: ");
dollars = scan.nextDouble();
convertToEuro = dollars * UsdToEuro;
System.out.println("The value of " + dollars + " USD is " + convertToEuro + " in Euros.");
if (scan.equals(quit))
stop = true;
stop = false;

All times are GMT +5.5. The time now is 07:40.