daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Jan 29th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class VaporStore {
  4.     public static void main(String[] args) {
  5.         Scanner s = new Scanner(System.in);
  6.  
  7.         double budget = Double.parseDouble(s.nextLine());
  8.  
  9.         double priceGame = 0.0;
  10.         double totalPrice = 0.0;
  11.         boolean isTrue = true;
  12.         double count = budget;
  13.  
  14.         while (isTrue) {
  15.  
  16.             String comannd = s.nextLine().toLowerCase();
  17.  
  18.  
  19.             if (comannd.equals("game time")) {
  20.                 isTrue = false;
  21.             }
  22.  
  23.  
  24.             else {
  25.  
  26.                 if (comannd.equals("outfall 4")) {
  27.  
  28.                     priceGame = 39.99;
  29.                     if (priceGame > count) {
  30.                         System.out.println("Too Expensive");
  31.                     } else {
  32.                         System.out.println("Bought OutFall 4");
  33.                         totalPrice += priceGame;
  34.                         count = count - priceGame;
  35.                     }
  36.                 }
  37.  
  38.  
  39.  
  40.                 else if (comannd.equals("cs: og")) {
  41.                     priceGame = 15.99;
  42.                     if (priceGame > count) {
  43.                         System.out.println("Too Expensive");
  44.                     } else {
  45.                         System.out.println("Bought CS: OG");
  46.                         totalPrice += priceGame;
  47.                         count = count - totalPrice;
  48.                     }
  49.  
  50.                 }
  51.  
  52.  
  53.                 else if (comannd.equals("zplinter zell")) {
  54.                     priceGame = 19.99;
  55.                     if (priceGame > count) {
  56.                         System.out.println("Too Expensive");
  57.                     } else {
  58.                         System.out.println("Bought Zplinter Zell");
  59.                         totalPrice += priceGame;
  60.                         count = count - priceGame;
  61.                     }
  62.  
  63.                 }
  64.  
  65.  
  66.                 else if (comannd.equals("honored 2")) {
  67.                     priceGame = 59.99;
  68.                     if (priceGame > count) {
  69.                         System.out.println("Too Expensive");
  70.                     } else {
  71.                         System.out.println("Bought Honored 2");
  72.                         totalPrice += priceGame;
  73.                         count = count - priceGame;
  74.                     }
  75.  
  76.                 }
  77.  
  78.  
  79.                 else if (comannd.equals("roverwatch")) {
  80.                     priceGame = 29.99;
  81.                     if (priceGame > count) {
  82.                         System.out.println("Too Expensive");
  83.                     } else {
  84.                         System.out.println("Bought RoverWatch");
  85.                         totalPrice += priceGame;
  86.                         count = count - priceGame;
  87.                     }
  88.  
  89.                 }
  90.  
  91.  
  92.  
  93.                 else if (comannd.equals("roverwatch origins edition")) {
  94.                     priceGame = 39.99;
  95.                     if (priceGame > count) {
  96.                         System.out.println("Too Eexpensive");
  97.                     } else {
  98.                         System.out.println("Bought RoverWatch Origins Edition");
  99.                         totalPrice += priceGame;
  100.                         count = count - priceGame;
  101.                     }
  102.  
  103.                 }
  104.  
  105.                 else {
  106.                     System.out.println("Not Found");
  107.                 }
  108.  
  109.             }
  110.  
  111.  
  112.  
  113.  
  114.             if (count <= 0) {
  115.                 System.out.println("Out of money!");
  116.                 isTrue = false;
  117.             }
  118.         }
  119.  
  120.  
  121.         if (budget > totalPrice) {
  122.             double save = budget - totalPrice;
  123.             System.out.printf("Total spent: $%.2f. Remaining: $%.2f", totalPrice, save);
  124.         }
  125.     }
  126. }
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top