import java.util.Scanner; /* * Illustrates the use of the dot operator with a Scanner object */ public class TipCalculator{ public static void main(String[] args){ Scanner input = new Scanner(System.in); double price, percent, tip; System.out.println("Enter the price of the meal:"); price = input.nextDouble(); System.out.println("\nEnter the percent you want to tip (e.g. .20 or .15):"); percent = input.nextDouble(); tip = price * percent; System.out.println("\n\n====================="); System.out.println("Tip amount: " + tip); System.out.println("Total cost: " + (price + tip)); System.out.println("====================="); } }