Any idea how to to calculate double and long together?
parseDouble(java.lang.String) in java.lang.Double cannot be applied to (long)
That was what i did. Any ideas?
Double rate = 0.35; Double gross = 950.0; long totalIncome; Double total; total = rate * Double.parseDouble(totalIncome) + gross
A question though: is there a reason that you are using the Double class rather than the double primative? Also, you don't jinitialize totalIncome in your code example. I assume that this is just an oversite.
long totalIncome = 1000L; // there should be the letter "L" on the end here // the forum software is deleting it double grossIncome = 950.0; double total = totalIncome + grossIncome; System.out.println(total);
I use the double class because my rates are inNo, you don't understand. double != Double.
Example: 0.57% = 0.0057
I can't use long for it, cause the compiler will give
Double rate = 0.35; Double gross = 950.0; long totalIncome = 0l; Double total; total = rate * totalIncome + gross;