Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class StoreReceipt {
- static final double TSHIRT_PRICE = 11.1075;
- static final double CHIPS_PRICE = 12.5215;
- static final double COKE_PRICE = 1.99;
- String a;
- static int numberShirts;
- static int numberChips;
- static int numberCoke;
- static double tshirtTotal = TSHIRT_PRICE * numberShirts;
- static double chipsTotal = CHIPS_PRICE * numberChips;
- static double cokeTotal = (COKE_PRICE + 1.20) * numberCoke;
- static double finalTotal = tshirtTotal + chipsTotal + cokeTotal;
- {
- }
- private static Scanner input;
- input = new Scanner(System.in);
- System.out.println("What's your name?");
- String a = input.nextLine();
- System.out.println("Welcome to Fantastiko Market, " + a + "! Heres the following items for saleing:");
- System.out.println("T-shirt $18.95 15% off");
- System.out.println("Chips $1.79 15% off");
- System.out.println("Coke $2.99");
- System.out.println("How many T-shirts do you want?");
- String numberShirts = input.nextLine();
- System.out.println("How many bags of potato chips?");
- String numberChips = input.nextLine();
- System.out.println("What about 12-pack coke?");
- String numberCoke = input.nextLine();
- double tshirtTotal = TSHIRT_PRICE * numberShirts;
- double chipsTotal = CHIPS_PRICE * numberChips;
- double cokeTotal = (COKE_PRICE + 1.20) * numberCoke ;
- tshirtTotal = tshirtTotal * .85;
- chipsTotal = chipsTotal * .85;
- tshirtTotal = tshirtTotal * 1.06;
- double finalTotal = tshirtTotal + chipsTotal + cokeTotal;
- System.out.println("Your total is: " + finalTotal);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement