-
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
-
 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
-
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
Forum Rules
|
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
|
Bookmarks