Welcome to Dream.In.Code
Become a Java Expert!

Join 149,609 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,860 people online right now. Registration is fast and FREE... Join Now!




java.lang.NoClassDefFoundError:

 
Reply to this topicStart new topic

java.lang.NoClassDefFoundError:, currency convertion, it doesnt work, help please

cheermom
21 Sep, 2007 - 12:29 PM
Post #1

New D.I.C Head
*

Joined: 25 Apr, 2007
Posts: 7


My Contributions
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
User is offlineProfile CardPM
+Quote Post

alpha02
RE: Java.lang.NoClassDefFoundError:
21 Sep, 2007 - 12:33 PM
Post #2

D.I.C Addict
Group Icon

Joined: 20 May, 2006
Posts: 687


Dream Kudos: 850
My Contributions
No class found.. are you sure you specified the correct package for "currency"?
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Java.lang.NoClassDefFoundError:
21 Sep, 2007 - 12:58 PM
Post #3

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,306



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Does the .java file have the same name as the class name?

What is this code supposed to do?
CODE

                dollar == 0.72 Euro
                dollar == 0.50 Pound
                dollar == 115.38 yen

User is offlineProfile CardPM
+Quote Post

PennyBoki
RE: Java.lang.NoClassDefFoundError:
21 Sep, 2007 - 12:59 PM
Post #4

system("revolution");
Group Icon

Joined: 11 Dec, 2006
Posts: 2,010



Thanked: 7 times
Dream Kudos: 500
Expert In: Java,C++,C

My Contributions
what is this code:
QUOTE
dollar == 0.72 Euro
dollar == 0.50 Pound
dollar == 115.38 yen


what is the purpose of it?
[edit]jayman9 beat me, next time dude smile.gif

This post has been edited by PennyBoki: 21 Sep, 2007 - 01:00 PM
User is offlineProfile CardPM
+Quote Post

alpha02
RE: Java.lang.NoClassDefFoundError:
21 Sep, 2007 - 01:03 PM
Post #5

D.I.C Addict
Group Icon

Joined: 20 May, 2006
Posts: 687


Dream Kudos: 850
My Contributions
QUOTE(PennyBoki @ 21 Sep, 2007 - 04:59 PM) *

what is this code:
QUOTE
dollar == 0.72 Euro
dollar == 0.50 Pound
dollar == 115.38 yen


what is the purpose of it?
[edit]jayman9 beat me, next time dude smile.gif


I think he wants to compare the dollar with different currencies.. But it woN't work of course.. == is used to compare 2 things in a IF statement, and = is used to assign. The dollar variable won't contain all currency info!
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Java.lang.NoClassDefFoundError:
21 Sep, 2007 - 01:08 PM
Post #6

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,306



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
I thought as much too, but thought it better to ask. No point in typing out a long explanation as to why it was wrong, until I knew what their intentions were.
User is offlineProfile CardPM
+Quote Post

PennyBoki
RE: Java.lang.NoClassDefFoundError:
21 Sep, 2007 - 01:12 PM
Post #7

system("revolution");
Group Icon

Joined: 11 Dec, 2006
Posts: 2,010



Thanked: 7 times
Dream Kudos: 500
Expert In: Java,C++,C

My Contributions
QUOTE(alpha02 @ 21 Sep, 2007 - 02:03 PM) *

QUOTE(PennyBoki @ 21 Sep, 2007 - 04:59 PM) *

what is this code:
QUOTE
dollar == 0.72 Euro
dollar == 0.50 Pound
dollar == 115.38 yen


what is the purpose of it?
[edit]jayman9 beat me, next time dude smile.gif


I think he wants to compare the dollar with different currencies.. But it woN't work of course.. == is used to compare 2 things in a IF statement, and = is used to assign. The dollar variable won't contain all currency info!

I kinda figured as much wink2.gif, but he/she should try to explain more, not we trying to interpret what are they trying to do, I think smile.gif

[edit]jayman9 beat me again ok sad.gif damn I'm slow

This post has been edited by PennyBoki: 21 Sep, 2007 - 01:14 PM
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Java.lang.NoClassDefFoundError:
21 Sep, 2007 - 01:19 PM
Post #8

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,306



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
It is not often that I am a step ahead of anyone, PennyBoki. Guess it is just my lucky day. wink2.gif
User is offlineProfile CardPM
+Quote Post

alpha02
RE: Java.lang.NoClassDefFoundError:
21 Sep, 2007 - 01:20 PM
Post #9

D.I.C Addict
Group Icon

Joined: 20 May, 2006
Posts: 687


Dream Kudos: 850
My Contributions
That topic is kinda hard to follow
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 12:12AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month