DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2005
    Posts
    2

    Can understand whats wrong with this simple code.

    I'm sort new to Java programing, and I created this simple converter, but when I try to complie it, it gives me an exception error, could some one tell me how to correct this code.

    Code:
     import java.text.*;
    import javax.swing.*;
    
    public class Converter
    {
    	private final static double EURO = .8295577, YEN = 115.614, CAD = 1.17781;
    	
    	public static void main (String[] args)
        {
    	 	String input =null;
    	 	double US= 0.0;
    	 	DecimalFormat twoPrecision = new DecimalFormat("0.00");
    	    input() = 0
     		
    		try{
    	
    		    
    		     US = Double.parseDouble (input);
    			 System.out.print("US to Euro: ");
    			 System.out.println(twoPrecision.format(US * EURO));
    	       
    	       
    	         US = Double.parseDouble (input);
    			 System.out.print("US to Yen: ");
    			 System.out.println(twoPrecision.format(US * YEN));
    		
    		
    		     
    	         US = Double.parseDouble (input);
    			 System.out.print("US to Cad: ");
    			 System.out.println(twoPrecision.format(US * CAD));
    		
    		}
    		catch(NumberFormatException e)
    		{
    			JOptionPane.showMessageDialog(null,
    			                 "You must enter a number",
    			                 "Input data error",
    			                 JOptionPane.ERROR_MESSAGE);
    		}
    	}
    }

  2. #2
    Join Date
    Nov 2005
    Posts
    2
    The compliler reports the error t line 14, which is under "input( ) = 0" and above "try {"

    Error: ',' expected

  3. #3
    Join Date
    Sep 2005
    Location
    istanbul / Turkey
    Posts
    133
    input() = 0
    ..?
    if i change it with
    input = "10";
    it runs.

Similar Threads

  1. Whats wrong with this code
    By atu_atu in forum XML
    Replies: 1
    Last Post: 06-15-2005, 07:22 PM
  2. Microsoft's C++ bigotry
    By Phil Weber in forum .NET
    Replies: 632
    Last Post: 10-01-2003, 12:00 AM
  3. Another Language
    By Steven Bell in forum .NET
    Replies: 260
    Last Post: 06-01-2001, 04:32 PM
  4. Comparision --what's wrong in this simple fragment
    By arun_co@yahoo.com Arun in forum XML
    Replies: 4
    Last Post: 03-22-2001, 10:47 AM
  5. Whats wrong with this code
    By Viji in forum XML
    Replies: 1
    Last Post: 11-01-2000, 03:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links