Staredit Network

Staredit Network -> Computers and Technical -> Problem with Java
Report, edit, etc...Posted by saibaman8 on 2006-01-03 at 08:47:43
For an assignment in our class, we have to write a program that asks the user to input the value of the Euro and then convert whatever dollar amount they enter to Euros until they hit the cancel button on the input dialog. It compiles without any error, but when I run it, it says \"Exception in thread \'main\' java.lang.NoClassDefFoundError: Currency\". I don\'t use the Currency class or even the word Currency anywhere in either of the classes. Any idea what\'s going on?
Report, edit, etc...Posted by BeeR_KeG on 2006-01-03 at 09:26:41
>Moved to Programming
Report, edit, etc...Posted by CheeZe on 2006-01-03 at 11:11:54
-Dont' have main class?

-Problem is too vague without letting us see the code.
Report, edit, etc...Posted by DT_Battlekruser on 2006-01-03 at 20:19:53
Could there be a 'Currency' class that needs to be imported? Though if you never use the word, I doubt it..
Report, edit, etc...Posted by saibaman8 on 2006-01-05 at 08:36:32
Test class:
CODE
import javax.swing.JOptionPane;
public class CurConversionTest {
   
   public static void main(String[] args) {
       String input = JOptionPane.showInputDialog(\\\"Enter the value of the Euro\\\");
       double euro = Double.parseDouble(input);
       
       CurConversion a = new CurConversion(euro);
       boolean done;
       done = false;
       double dollar;
       while (!done)
       {
        input = JOptionPane.showInputDialog(\\\"Enter dollar amount to convert. Cancel quits\\\");
        if (input == null)
         done = true;
        else
        {
         dollar = Double.parseDouble(input);
         System.out.println(\\\"$\\\" + dollar + \\\" is equal to \\\" + a.convert(dollar) + \\\" Euros.\\\");
        }
       }
   }
}

Our teacher wants us to use multiple classes so we can get used to having a lot of methods, so here\'s the main class:
CODE
public class CurConversion
{
public CurConversion(double euro)
{
 euroValue = euro;
}

public double convert(double dollar)
{
 return euroValue * dollar;
}

private double euroValue;
}
Report, edit, etc...Posted by CheeZe on 2006-01-05 at 17:51:33
Umm.. why do you have \\\ before the quotations?

Remove those and it works. :/
Report, edit, etc...Posted by saibaman8 on 2006-01-12 at 19:31:03
Woah! Where did those come from? They aren't in the actual code. It must have been some formatting thing.
Next Page (1)