
CMSC131 Spring 2005, Quiz #1, Duration 15 Minutes
First Name: Last Name:
Student Id: Section: TAs:
Write a complete Java program that implements a currency converter. The program will convert
dollars to euros. The program’s specifications are:
• The program will read the exchange rate from dollars to euros. In other words, how may
euros you will get for one dollar. Display the message “Enter Rate” to enter this value.
• The program will read the amount in dollars you want to convert to euros. Use the message
“Enter dollars” to enter this value.
• To convert dollars to euros multiply the exchange rate by the number of dollars.
• The program will print the message: "Equivalency in Euros: " followed by the amount in
euros. The name of the Java class will be Converter.
• You must use JOptionPane for input and output operations.
• Use variables of type double to keep track of the exchange rate and the number of dollars.
• The name of the Java class will be Converter.
WRITE YOUR ANSWER ON THE NEXT PAGE.