// Prints the subtotal, tax, tip and total amount for a receipt public class ReceiptGoodVersion { public static void main(String[] args) { // Calculate total owed, assuming 8% tax / 15% tip // use doubles because that is the type the data represents double subtotal = 38 + 40.5 + 30; double tax = subtotal * .08; double tip = subtotal * .15; double total = subtotal + tax + tip; System.out.println("Subtotal: " + subtotal); System.out.println("Tax: " + tax); System.out.println("Tip: " + tip); System.out.println("Total: " + total); } }