Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. public class Project2_BaileyHollingsworth {
  2. public static void main(String[] args){
  3.  
  4. //Bailey Hollingsworth
  5.  
  6. final float bookDesignPatterns = 32.46f; //Price of each book type.
  7. int numberOfDesignPatterns = 2; //Amount of that book purchased
  8.  
  9. final float bookEffectiveJava = 35.48f;
  10. int numberOfEffectiveJava = 3;
  11.  
  12. final float bookJavaPuzzlers = 27.86f;
  13. int numberOfJavaPuzzlers = 1;
  14.  
  15. float preTaxCost = (bookDesignPatterns * numberOfDesignPatterns) + //Sums up the raw cost of the purchase
  16. (bookEffectiveJava * numberOfEffectiveJava) + (bookJavaPuzzlers * numberOfJavaPuzzlers);
  17.  
  18. final double salesTax = preTaxCost * 0.065;; //Represents 6.5% tax rate in calculation
  19.  
  20. double totalCost = (preTaxCost + salesTax); //Adds the sales tax to the raw amount for a final cost
  21.  
  22. System.out.println("Your purchase total is: $" + preTaxCost);
  23. System.out.println("Sales tax is: $" + salesTax);
  24. System.out.println("The total cost today will be: $" + totalCost);
  25.  
  26.  
  27.  
  28.  
  29.  
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement