product total price

product total price - int bookQuantity = in.nextInt/Process...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package bookorder; import java.util.Scanner; /** * * @author Manny */ public class BookOrder { /** * @param args the command line arguments */ public static void main(String[] args) { // start here yo! //Define constant final double SALES_TAX_RATE = 0.085; final double SHIPPING_FEE = 5.99; //Input Scanner in = new Scanner(System.in); System.out.print("Please enter the price of the book: "); double unitBookPrice = in.nextDouble(); System.out.print("Please enter the quantity of books: ");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: int bookQuantity = in.nextInt(); //Process double totalPrice = 0; double totalBookPrice = unitBookPrice * bookQuantity; totalPrice = totalPrice + totalBookPrice; double totalTax = totalBookPrice * SALES_TAX_RATE; totalPrice = totalPrice + totalTax; double totalShipping = bookQuantity * SHIPPING_FEE; totalPrice = totalPrice + totalShipping; //Output System.out.println("The total price with tax and shipping is: " + totalPrice); } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online