The total bill for the meal (the meal charge plus the tax and the tip)
public class menu {
public static void main(String[] args)
{
double burgers;
double soda;
double meal;
double tax = 0.0825;
double taxAmount;
double totalWithTax;
double tipRate = 0.15;
double tipAmount;
double totalBill;
//charge and tax
burgers = 5 * 6.95;
soda = 4 * 1.75;
meal = burgers + soda;
taxAmount = meal*tax;
totalWithTax = meal + tax;
tipAmount = totalWithTax * tipRate;
totalBill = meal + taxAmount + tipAmount;
System.out.println("Total meal charge $ "+ meal);
System.out.println("Tax amount "+ taxAmount);
System.out.println("Tip amount " + tipAmount);
System.out.println("Total bill " + totalBill);
}
}
output:
Total meal charge $ 41.75
Tax amount 3.444375 <=== I need truncated to 3.44
Tip amount 6.274875000000001 <=== I need this truncated to 6.78
Total bill 51.46925