DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Posts
    14

    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
    ThankYou

  2. #2
    Join Date
    Jul 2005
    Posts
    78
    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

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