Results 1 to 3 of 3
  1. #1
    mylosol is offline Member
    Join Date
    May 2011
    Posts
    1
    Rep Power
    0

    Default Compile Error (decimal rounding attempt)

    I am having a problem while trying to get user input data from a textField to a variable. The users are inputting numbers, most of which are declared as double. I found an example on the Internet where the programmer turned the values into strings but when I try to recreate this I get 3 compile errors saying "Can not find symbol
    Symbol: method roundToDecimals(double, int)"

    Java Code:
    	
    public void buildGUI () {
    
    		Toolkit theKit = aWindow.getToolkit(); // Call the toolkit
    		// use the called toolkit to get the screen size
    		Dimension wndSize = theKit.getScreenSize();
    		// Set the position to screen center & size to half screen size
    		aWindow.setBounds(wndSize.width/4, wndSize.height/4, 350, 200);
    		// Tells the program to stop running whent the program is exited
    		aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		// Tells the program to display the window
    		aWindow.setVisible(true);
    
    		String loanAmountS = Double.toString(roundToDecimals(loanAmount,2));
    		loanAmountInput.setText(loanAmountS);
    		
    
    		String interestS = Double.toString(interest);
    		interestInput.setText(interestS);
    		
    
    		String loanTermS = Integer.toString(loanTerm);
    		loanTermInput.setText(loanTermS);
    		
    
    		String paymentAmountS = Double.toString(roundToDecimals(payment,2));;
    		paymentAmountOutput.setText(paymentAmountS);
    		
    
    		//*** Remaining Code***//
    	}

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Mind copy/pasting the exact errors?

  3. #3
    Toll's Avatar
    Toll is offline Senior Member
    Join Date
    May 2011
    Location
    Sweden
    Posts
    392
    Rep Power
    4

    Default

    Did you actually recreate the method roundToDecimal as well? It's likely a method that programmer made, and such you need that sourcecode or code it yourself.

Similar Threads

  1. Replies: 3
    Last Post: 01-01-2011, 02:36 AM
  2. I have Compile error but I couldn't fix it
    By Wishes in forum New To Java
    Replies: 25
    Last Post: 11-26-2010, 06:30 PM
  3. rounding double to two decimal places
    By javaMike in forum Advanced Java
    Replies: 15
    Last Post: 03-10-2010, 12:04 AM
  4. java division and decimal error
    By heartysnowy in forum New To Java
    Replies: 5
    Last Post: 10-07-2009, 04:57 PM
  5. Compile Error - Please Help!!
    By AJ2009 in forum New To Java
    Replies: 10
    Last Post: 01-04-2009, 03:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •