{"id":17996892,"url":"https://github.com/zk/barista","last_synced_at":"2025-04-04T06:14:39.546Z","repository":{"id":1092509,"uuid":"947513","full_name":"zk/barista","owner":"zk","description":"Programming exercise for the Denver Clojure Users Group.","archived":false,"fork":false,"pushed_at":"2010-09-29T06:38:57.000Z","size":286,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T17:28:17.163Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.meetup.com/Denver-Clojure-Meetup/","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zk.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-09-29T05:11:16.000Z","updated_at":"2013-10-19T17:09:38.000Z","dependencies_parsed_at":"2022-07-15T07:17:27.332Z","dependency_job_id":null,"html_url":"https://github.com/zk/barista","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zk%2Fbarista","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zk%2Fbarista/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zk%2Fbarista/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zk%2Fbarista/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zk","download_url":"https://codeload.github.com/zk/barista/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247128753,"owners_count":20888235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-29T21:16:10.072Z","updated_at":"2025-04-04T06:14:39.525Z","avatar_url":"https://github.com/zk.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"Barista-matic Programming Assignment\n\nPROBLEM DESCRIPTION:\n\nYour task is to create a simulator of an automatic coffee dispensing machine, called the Barista-matic.  The machine maintains an inventory of drink ingredients, and is able to dispense a fixed set of possible drinks by combining these ingredients in different amounts. The cost of a drink is determined by its component ingredients.\n\nUpon startup, the Barista-matic should display a list of its current inventory, followed by a menu to allow the user to select a drink.  As drinks are dispensed, the inventory should be updated.  Only drinks for which there is sufficient inventory can be dispensed.\n\nThe specified input and output formats for the Barista-matic must be followed exactly.  At the end of these instructions, you will find examples of some input/output scenarios.\n\nYour Barista-matic machine should be capable of dispensing the following drinks:\n\nDrink Name\nIngredients\nCoffee\t3 units of coffee, 1 unit of sugar, 1 unit of cream\nDecaf Coffee\t3 units of Decaf Coffee, 1 unit of sugar, 1 unit of cream\nCaffe Latte\t2 units of espresso, 1 unit of steamed milk\nCaffe Americano\t3 units of espresso\nCaffe Mocha\t1 units of Espresso, 1 unit of cocoa,  1 unit of steamed milk, 1 unit of whipped cream\nCappuccino\t2 units of Espresso, 1 unit of steamed milk, 1 unit of  foamed milk\n\nPer-unit ingredient costs are as follows:\n\nIngredient\nUnit Cost\nCoffee\t$0.75\nDecaf Coffee\n$0.75\nSugar\n$0.25\nCream\n$0.25\nSteamed Milk\n$0.35\nFoamed Milk\n$0.35\nEspresso\n$1.10\nCocoa\n$0.90\nWhipped Cream\n$1.00\n\nInitially the Barista-matic should contain 10 units of all ingredients, and restocking the machine should restore each ingredient to a maximum of 10 units.\nINPUT FORMAT:\n\nYour solution should read from the standard input stream, one command per line.  No prompts or other extraneous user messages should be displayed.  Blank input lines should be ignored.\n\nEach valid command consists of a single character, as follows:\n'R' or 'r' - restock the inventory and redisplay the menu\n'Q' or 'q' - quit the application\n[1-6] - order the drink with the corresponding number in the menu\nIf the user enters an invalid command, then the program should display a single-line message with the following format:\nInvalid selection: \u003ccharacters that were entered\u003e\nIf the user selects a valid drink number, and the machine has the required ingredients to make the drink, then the program should display a single-line message with the following format:\nDispensing: \u003cdrink name\u003e\nOn the other hand, if the drink order cannot be completed, then the program should display a single-line message with the following format:\nOut of stock: \u003cdrink name\u003e\nThe inventory and menu (see next section) should be displayed immediately following any applicable message.\nOUTPUT FORMAT:\n\nAll output should be written to the standard output stream.  At program startup, and following the processing of every command, the machine inventory and the drink menu should be displayed.  Both the inventory list and the drink menu should be displayed in alphabetic order (by ingredient name or drink name, respectively), in the following format:\nInventory:\n\n\u003cingredient name\u003e,\u003cquantity in inventory\u003e\n\n...\n\n\u003cingredient name\u003e,\u003cquantity in inventory\u003e\n\nMenu:\n\n\u003cdrink number\u003e,\u003cdrink name\u003e,\u003ccost\u003e,\u003cin-stock\u003e\n\n...\n\n\u003cdrink number\u003e,\u003cdrink name\u003e,\u003ccost\u003e,\u003cin-stock\u003e\nDrinks should be numbered sequentially, starting at 1, in the order they are displayed in the menu. The in-stock indicator should be either \"true\" or \"false\".\n\nNote: the sample output is indented in these instructions to make it easier to read.  The output generated by your program should not have any whitespace at the beginning of a line.\nTECHNICAL NOTES:\n\nYour solution should be a command-line program written in Java, C# or VB.NET.  If you use any external libraries in developing your solution (i.e. libraries that are not part of the standard Java or .NET platform) then you should bundle these libraries with your code so that we can run your solution.\n\nIt is not required that the initial machine configuration (inventory counts, available drinks and prices, etc.) be dynamic. In particular, it is acceptable to perform this initialization in code, rather than reading the configuration from an external file or database. However, your program should be flexible enough to allow new drinks to be added to the menu without requiring extensive code changes.\n\nMake sure your program works correctly for all combinations of inputs.  You may include automated tests if you like (using a framework such as JUnit or NUnit), but this is not required.\n\nExtensive inline or method-level comments are not required, unless you want to include them to highlight particular aspects of your design or implementation.\nEXAMPLE:\n\nUpon application startup, the initial inventory list and drink menu would look like this:\nInventory:\n\nCocoa,10\n\nCoffee,10\n\nCream,10\n\nDecaf Coffee,10\n\nEspresso,10\n\nFoamed Milk,10\n\nSteamed Milk,10\n\nSugar,10\n\nWhipped Cream,10\n\nMenu:\n\n1,Caffe Americano,$3.30,true\n\n2,Caffe Latte,$2.55,true\n\n3,Caffe Mocha,$3.35,true\n\n4,Cappuccino,$2.90,true\n\n5,Coffee,$2.75,true\n\n6,Decaf Coffee,$2.75,true\nFor input consisting of the following commands:\n2\n\nq\nthe program would produce the following output (including the startup output):\nInventory:\n\nCocoa,10\n\nCoffee,10\n\nCream,10\n\nDecaf Coffee,10\n\nEspresso,10\n\nFoamed Milk,10\n\nSteamed Milk,10\n\nSugar,10\n\nWhipped Cream,10\n\nMenu:\n\n1,Caffe Americano,$3.30,true\n\n2,Caffe Latte,$2.55,true\n\n3,Caffe Mocha,$3.35,true\n\n4,Cappuccino,$2.90,true\n\n5,Coffee,$2.75,true\n\n6,Decaf Coffee,$2.75,true\n\nDispensing: Caffe Latte\n\nInventory:\n\nCocoa,10\n\nCoffee,10\n\nCream,10\n\nDecaf Coffee,10\n\nEspresso,8\n\nFoamed Milk,10\n\nSteamed Milk,9\n\nSugar,10\n\nWhipped Cream,10\n\nMenu:\n\n1,Caffe Americano,$3.30,true\n\n2,Caffe Latte,$2.55,true\n\n3,Caffe Mocha,$3.35,true\n\n4,Cappuccino,$2.90,true\n\n5,Coffee,$2.75,true\n\n6,Decaf Coffee,$2.75,true\n\n  ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzk%2Fbarista","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzk%2Fbarista","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzk%2Fbarista/lists"}