import java.util.* ;

public class CurrencyConverterTester
{
    public static void main(String[] args)
    {
	Scanner scanner = new Scanner(System.in) ;
	System.out.println("How many euros is one dollar?") ;
	String input = scanner.nextLine() ;
	double rate = Double.parseDouble(input) ;
	CurrencyConverter converter = new CurrencyConverter(rate);



	boolean done = false;
        while (!done)
        {
        System.out.println("Dollar value (Q to quit)") ;
	input = scanner.nextLine() ;
	double amount = Double.parseDouble(input) ;
        
        if (input.equalsIgnoreCase("Q"))
        done = false;
        else        {
        double exchange = converter.convert(amount);
        System.out.println(amount + " dollars = " + exchange + " euro");
            }
                    }

	

    }
}

basically when i press q or Q i get an error
Exception in thread "main" java.lang.NumberFormatException: For input string: "q"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1224)
at java.lang.Double.parseDouble(Double.java:510)
at CurrencyConverterTester.main(CurrencyConverterTester.java:23)
Java Result: 1

You're parsing it as a double as soon as you read it. "Q" isn't a double.

lol, as soon as i posted i figured out what was wrong!!
i had to move lines 19 and 20 into the else {}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.