Advertisement
Guest User

gangang gggg

a guest
Jan 21st, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.51 KB | None | 0 0
  1. package arrays;
  2. import java.util.Scanner;
  3. public class weather {
  4.  
  5. public static void main(String[] args) {
  6.  
  7.  
  8.  
  9. //variables
  10. double pricedItem;
  11. int itemsCart;
  12. double precentSale;
  13. double totalAmount;
  14. double totalAmountB;
  15. int userSale;
  16. double tax;
  17. double taxed;
  18. double taxFull;
  19.  
  20. //------------------------
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28. Scanner in = new Scanner(System.in);
  29.  
  30. System.out.println(" _______ ______ __________ ");
  31. System.out.println(" // \\ // \\ // ");
  32. System.out.println(" // | // | // ");
  33. System.out.println(" //________/ //_______/ // ");
  34. System.out.println(" // // \\ //_________ ");
  35. System.out.println(" // // \\ // ");
  36. System.out.println(" // // \\ // ");
  37. System.out.println("// // \\ //____________.java ");
  38. System.out.println("Made by Danil Bezkorovaynyy ");
  39. //------------------------
  40.  
  41. //strings
  42. String namedItem;
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. //code
  50. System.out.println("--------------------------------");
  51. System.out.println("Thank you for using my sale calculator :) to begin, enter the amount of items that you will buy");
  52. System.out.println("--------------------------------");
  53.  
  54.  
  55.  
  56. //ask the use how many items they are buying
  57. System.out.println("--------------------------------");
  58. System.out.println("How many items are in your cart?");
  59. System.out.println("--------------------------------");
  60. itemsCart = in.nextInt();
  61.  
  62.  
  63.  
  64.  
  65. //ask the user about the name, price
  66. System.out.println("--------------------------------");
  67. System.out.println("what is the name of the item?");
  68. System.out.println("--------------------------------");
  69. namedItem = in.next();
  70. System.out.println("--------------------------------");
  71. System.out.println("What is the price for "+namedItem+"?");
  72. System.out.println("--------------------------------");
  73. pricedItem = in.nextDouble();
  74.  
  75. System.out.println("--------------------------------");
  76. System.out.println("Is "+namedItem+" on sale?");
  77. System.out.println("***Enter 1 for yes and 0 for no");
  78. System.out.println("--------------------------------");
  79. userSale = in.nextInt();
  80.  
  81.  
  82.  
  83. //ask the user if their items are on sale or not
  84. if (userSale == 1)
  85. {
  86. System.out.println("By how much precent is the item on sale for?");
  87. System.out.println("***Make sure to enter the amount like this.");
  88. System.out.println(" 70% = 0.70 ");
  89. System.out.println("--------------------------------");
  90. precentSale = in.nextDouble();
  91. totalAmount = precentSale * pricedItem;
  92. pricedItem = pricedItem - totalAmount;
  93. System.out.println("--------------------------------");
  94. System.out.println("The total price for "+namedItem+" will be $"+pricedItem);
  95. System.out.println("--------------------------------");
  96. }
  97. else
  98. { System.out.println("--------------------------------");
  99.  
  100. System.out.println("Your total price for "+namedItem+" will be $"+ pricedItem);
  101. System.out.println("--------------------------------");
  102. }
  103.  
  104.  
  105.  
  106.  
  107. //ask the user for the tax percentage
  108.  
  109. System.out.print("What is the tax % of tax in your state?");
  110. System.out.println(" ");
  111. System.out.println("--------------------------------");
  112. pricedItem = taxFull;
  113. tax = in.nextDouble();
  114. tax = pricedItem * tax;
  115.  
  116. System.out.println("--------------------------------");
  117. System.out.println("Your total price for "+namedItem+" is going to be $"+taxFull);
  118. System.out.println("--------------------------------");
  119.  
  120.  
  121.  
  122.  
  123. //------------------------
  124. //test data
  125.  
  126.  
  127.  
  128. }
  129.  
  130. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement