Advertisement
jinglis

Total Price

Jul 8th, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.30 KB | None | 0 0
  1. /* Name: James Inglis
  2.  * Syntax: Java
  3.  * Date: 7/8/14
  4.  * Description: This program takes in the price for an item,
  5.  *              the markup percentage, and sales tax. Then, computes
  6.  *              to find the total price for the item.
  7.  */
  8.  
  9.  import java.util.*;
  10.  
  11.  public class Num12
  12.  {
  13.    static Scanner console = new Scanner(System.in);
  14.    static final double SALES_TAX = 6.25; // Tax Percentage.
  15.    
  16.    public static void main(String[] args)
  17.    {
  18.       double readPrice,taxPrice, totalPrice, markUpPer;
  19.       int markUp;
  20.      
  21.       // Getting the item price.
  22.       System.out.print("Enter in the price of the item: ");
  23.       readPrice = console.nextDouble();
  24.       System.out.println();
  25.      
  26.       // Getting the markup.
  27.       System.out.print("Enter in the markup percentage: ");
  28.       markUp = console.nextInt();
  29.       System.out.println();
  30.      
  31.      
  32.       // Converting markup percentage and sales tax. Then, adding to sales item.
  33.       markUpPer = ((double)(markUp) / 100) * readPrice;
  34.       taxPrice = readPrice / SALES_TAX;
  35.      
  36.       totalPrice = markUpPer + taxPrice + readPrice;
  37.      
  38.       // Displaying the total price of item.
  39.       System.out.printf("The total price for the item is: $%.2f",totalPrice);
  40.      
  41.    }
  42.    
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement