Advertisement
ZhenghaoZhu

DiscountDeterminer

Nov 11th, 2015
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1.  
  2. import java.util.*;
  3. import java.text.*;
  4.  
  5. public class DiscountDeterminer{
  6.   public static void main (String []args){
  7.     Scanner input = new Scanner(System.in);
  8.     System.out.println("Could you give me the price of the discounted item?");
  9.     double price = input.nextDouble();
  10.     System.out.println("How much discount is there?");
  11.     double percent = input.nextDouble();
  12.     double npercent = (100-percent)* 0.01;
  13.     double nc = price * (npercent);
  14.     double ncwt = nc * 1.08875;
  15.     DecimalFormat dfA = new DecimalFormat("$###.00");
  16.     System.out.println("The new price of the discounted item is " + dfA.format(nc) + ".");
  17.     System.out.println("The price with tax is " + dfA.format(ncwt) + ".");
  18.  
  19.  
  20.  
  21.  
  22.   }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement