You are viewing a single comment's thread. Return to all comments →
Using explicit type casting to convert double into an int
double tip = meal_cost/100*tip_percent; double tax = meal_cost/100*tax_percent;
int total_cost = (int)(meal_cost+tip+tax); System.out.println(total_cost);
Seems like cookies are disabled on this browser, please enable them to open this website
Day 2: Operators
You are viewing a single comment's thread. Return to all comments →
double tip = meal_cost/100*tip_percent; double tax = meal_cost/100*tax_percent;