/* * Write an application that accepts the weight of a bag of coffee * in pounds and the number of bags sold and displays the total price of the sale. * * Where the cost per pound is $5.99 and the sales tax is 7.25% * * @author Anthony Larrain * Spring 2006 */ import java.util.Scanner; class CostOfCoffee{ static final double COST_PER_POUND = 5.99; static final double SALES_TAX = 0.0725; static Scanner console = new Scanner(System.in); public static void main(String [] args){ // prompt for weight of coffee System.out.println("Enter weight"); // get weight from the console double weight = console.nextDouble(); // prompt for number of bags System.out.println("Enter number of bags"); // get number of bags from the console int bags = console.nextInt(); double price = weight * COST_PER_POUND * bags; double totPrice = price + (price * SALES_TAX); System.out.println("Your cost is $" + totPrice); } }