Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package arrays;
- import java.util.Scanner;
- public class weather {
- public static void main(String[] args) {
- //variables
- double pricedItem;
- int itemsCart;
- double precentSale;
- double totalAmount;
- double totalAmountB;
- int userSale;
- double tax;
- double taxed;
- double taxFull;
- //------------------------
- Scanner in = new Scanner(System.in);
- System.out.println(" _______ ______ __________ ");
- System.out.println(" // \\ // \\ // ");
- System.out.println(" // | // | // ");
- System.out.println(" //________/ //_______/ // ");
- System.out.println(" // // \\ //_________ ");
- System.out.println(" // // \\ // ");
- System.out.println(" // // \\ // ");
- System.out.println("// // \\ //____________.java ");
- System.out.println("Made by Danil Bezkorovaynyy ");
- //------------------------
- //strings
- String namedItem;
- //code
- System.out.println("--------------------------------");
- System.out.println("Thank you for using my sale calculator :) to begin, enter the amount of items that you will buy");
- System.out.println("--------------------------------");
- //ask the use how many items they are buying
- System.out.println("--------------------------------");
- System.out.println("How many items are in your cart?");
- System.out.println("--------------------------------");
- itemsCart = in.nextInt();
- //ask the user about the name, price
- System.out.println("--------------------------------");
- System.out.println("what is the name of the item?");
- System.out.println("--------------------------------");
- namedItem = in.next();
- System.out.println("--------------------------------");
- System.out.println("What is the price for "+namedItem+"?");
- System.out.println("--------------------------------");
- pricedItem = in.nextDouble();
- System.out.println("--------------------------------");
- System.out.println("Is "+namedItem+" on sale?");
- System.out.println("***Enter 1 for yes and 0 for no");
- System.out.println("--------------------------------");
- userSale = in.nextInt();
- //ask the user if their items are on sale or not
- if (userSale == 1)
- {
- System.out.println("By how much precent is the item on sale for?");
- System.out.println("***Make sure to enter the amount like this.");
- System.out.println(" 70% = 0.70 ");
- System.out.println("--------------------------------");
- precentSale = in.nextDouble();
- totalAmount = precentSale * pricedItem;
- pricedItem = pricedItem - totalAmount;
- System.out.println("--------------------------------");
- System.out.println("The total price for "+namedItem+" will be $"+pricedItem);
- System.out.println("--------------------------------");
- }
- else
- { System.out.println("--------------------------------");
- System.out.println("Your total price for "+namedItem+" will be $"+ pricedItem);
- System.out.println("--------------------------------");
- }
- //ask the user for the tax percentage
- System.out.print("What is the tax % of tax in your state?");
- System.out.println(" ");
- System.out.println("--------------------------------");
- pricedItem = taxFull;
- tax = in.nextDouble();
- tax = pricedItem * tax;
- System.out.println("--------------------------------");
- System.out.println("Your total price for "+namedItem+" is going to be $"+taxFull);
- System.out.println("--------------------------------");
- //------------------------
- //test data
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement