In Java, operations in parentheses have the highest priority. Here tip1 = 2.4 and tip2 = 0.0 although tip1 should be equal.
double mealCost = 12; int tipPercent = 20; double tip1 = mealCost*tipPercent/100; double tip2 = mealCost*(tipPercent/100); System.out.println(tip1); System.out.println(tip2);
tipPercent/(double)100well ortipPercent/(float)100..... depending on what accuracy you want to get - Alexey Shimansky