Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.HashMap;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- HashMap<String, Integer> myMenu = new HashMap<String, Integer>();
- myMenu.put("Bread", 70000);
- myMenu.put("Big_Cookies", 12000);
- myMenu.put("Small_Cookies", 12000);
- myMenu.put("Chocolate_Brownies", 9000);
- myMenu.put("Arequipe_Brownies", 9000);
- myMenu.put("Simple_Brownies", 8000);
- myMenu.put("Cheesecake", 6000);
- myMenu.put("Cinnamon Rolls", 6000);
- myMenu.put("Lemon Mug Cake", 12000);
- System.out.println("Menu:");
- int menuSlot = 1;
- for (String name : myMenu.keySet()) {
- System.out.println("Item #" + menuSlot + ": " + name + " = " + myMenu.get(name));
- menuSlot++;
- }
- Scanner keyboard = new Scanner(System.in);
- String order = " ";
- int orderTotal = 0;
- while (!(order.equals("exit"))) {
- System.out.println("Please enter the name of the item you wish to purchase. Type exit when your list is complete");
- order = keyboard.nextLine();
- if (order.equals("exit")) {
- }else {
- System.out.println("You ordered: " + order);
- System.out.println("Great! How many would you like?");
- Scanner quantity = new Scanner(System.in);
- int Quanitity = quantity.nextInt();
- orderTotal = orderTotal + (myMenu.get(order) * Quanitity);
- }
- }
- System.out.println("code end");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement