DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2006

    Help with combining doubles and int

    Hello to all-
    I have a newbie problem. How do you combine a doubles with a int.

    First, the variables that I have are: dollars*years*rate/100

    Second, the "year" is in the int. format

    Third, the "dollars, rate and the divided by 100" are in the double format.

    I need to combine those to have just one value or total of all of those variables that I have listed in the second sentence.

    I have something like this, but this is not compilng:
    double paidInterest = (int)(dollars*years*rate/100);

    The paidInterest or total or one values, is the product that I need from the variable calculation.
    This paidInterest will display in GUI "show message box"

    Note, I have included below, a example of one out of the 3 "input messages" box. And of course the other 2 GUI,s are are in the double format.

    int year;
    String oneRevolution = JOptionPane.showInputDialog(null,"How many years will you take the loan?(whole number)");
    year = Integer.parseInt(oneRevolution); ]

    Anyhelp or suggestions

  2. #2
    Join Date
    Jul 2005
    Quote Originally Posted by Recency
    I have something like this, but this is not compilng:
    double paidInterest = (int)(dollars*years*rate/100);
    Maybe because you're casting an int value to a double?

    Just guessing...

Similar Threads

  1. Replies: 0
    Last Post: 01-23-2003, 12:08 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
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.