We want to sell tills to local hipster coffee shop who are finally embracing the 21st century. We need a new till to replace their vintage machines - unfortunately, hipster staff are too cool to learn a new system, so we need you to build something that they will understand.
Instructions:
- Git clone this repo
- in command line type
bundle install
- create database
till_tech_devalopment
in psql - in command line type : ruby app/app.rb
- in your browser go to
localhost:4567
[Screenshot-1] [Screenshot-2] [Screenshot-3]
Sinatra
DataMapper
- clone this repo
- type rspec init
- check test
- type: irb
- type: require'./lib/menu'
- create object: m=Menu.new
- type: m.showmenu - you should see :
- type: m.order("Cafe Latte",5)
- type: m.order("Affogato",5)
- type: m.order("Tea",5)
- type: m.order("Choc Mousse",5)
- or everything what do you want
- type: m.prices
- type: m.sum
- type: m.taxes
- type: m.discount
- type: m.money(200) or any other sum
- type: m.charge
- type: m.current_time
- type: m.total_bill
Test checks that:
-
- We can see the list of the customer order
-
- We can see prices and quantity of products in customer bill
-
- We can see the final sum of the bill
-
- We can see the tax of the final sum of the bill
-
- We can see price with 5% discount in case our purchase is more than 50$
-
- We can see the discount separately in our bill
-
- We can see the change of the customer
-
- We can see the discount to various maffins
Program has 1 class Menu and methods
def Initialize
(sets ours vars and grabs data fromjson
file)def order
(compares each customer order with data fromjson
file, also adds quantity of each product and checks muffin discount)def prices
(shows price of each ordered product separately)def sum
(shows total sum of bill, and makes a discount in case the bill is more than 50$)def taxes
(shows the taxes)def discount
(shows amount of discount separately)def money
(shows amount of money which gives customer)def charge
(shows the change which gets customer)