import java.util.Scanner; public class GameStore { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double money = Double.parseDouble(scanner.nextLine()); String input = scanner.nextLine(); double price; boolean isBroke = false; double totalSpent = 0; while (!"Game Time".equals(input)){ switch (input) { case "OutFall 4": price = 39.99; break; case "CS: GO": price = 15.99; break; case "Zplinter Zell": price = 19.99; break; case "Honored 2": price = 59.99; break; case "RoverWatch": price = 29.99; break; case "RoverWatch Origins Edition": price = 39.99; break; default: System.out.println("Not Found"); input = scanner.nextLine(); continue; } if (money < price){ System.out.println("Too Expensive"); }else { System.out.printf("Bought %s%n", input); totalSpent += price; money -= price; } if (money == 0){ System.out.println("Out of money!"); isBroke = true; break; } input = scanner.nextLine(); } if (!isBroke){ System.out.printf("Total spent: $%.2f. Remaining: $%.2f", totalSpent, money); } } }