I am back, I think this course might kill me, any way here is my newest assignment:
I need to make a program that the user can input a U.S. dollar amount and will see what the value is in yen, pounds, and euros. I am TOTALLY LOST. one of the errors I am getting is no class def found, I do not understand this at all.
This is the exact assignment:
Create a class that converts U.S. dollars into three other currencies of your choice (i.e., euros, yens, and pounds). The user inputs the U.S. dollar amount through a dialogue box. Each conversion should be placed in a separate method that returns the value. Declare the conversion rates as static variables. Find currency rates here:
http://www.xe.com/ucc/Include a display method within the Converter class. Use the DecimalFormat class (as described in Case Two, Chapter 1) to display the monetary amounts. Use the class’s overloaded constructor to define a string pattern for display, as in the following statement:
DecimalFormat df = new DecimalFormat("###.00");
Write, compile, and run another class to test the Converter class.
CODE
import javax.swing.JOptionPane;
import Java.text.DecimalFormat;
public class currency
{
public static void main(sting[] args)
{
//currency's to convert
double dollars, euros, yen, pounds;
// Conversion rates
//1.00 USD =0.72 EURO
//1.00 USD =0.50 GBP
//1.00 USD = 115.38 JPY
dollar = 0.72 Euro
dollar = 0.50 Pound
dollar = 115.38 yen
System.out.pritnln ("1 dollar = " + euros + "euros";
System.out.println ("1 dollar = " + yen + "yen";
System.out.println ("1 dollar = " + pounds "pounds";
DecimalFormat form = newDecimalFormat (".00");
JOptionPane.showMessageDialog (null, "Your total Yen for that amount of Dollars is: " + dollar * .50);
JOptionPane.showMessageDialog (null, "Your total Euros for that amount of Dollars is: " + dollars * .72);
JOptionPane.showMessageDialog (null, "Your total Pounds for that amount of Dollars is: " + dollars * 115.38);
System.exit (0);
}
}
These are the errors I am getting:
-jGRASP exec: java currency
java.lang.NoClassDefFoundError: currency
Exception in thread "main"
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.
----jGRASP exec: java currency
java.lang.NoClassDefFoundError: currency
Exception in thread "main"
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.
I would love any help I can get, Thanks.
This post has been edited by cheermom: 22 Sep, 2007 - 09:04 AM