GithubHelp home page GithubHelp logo

cafe-billing's Introduction

Cafe-billing

Pre-requisite

  • Java 1.8 +
  • Scala 2.12.6
  • sbt 1.1.4

Running tests

In terminal run following command
sbt test

Assumptions

  1. For this exercise data type of food price is selected as BigDecimal and not a DomainObject such as Money. Creating a domain object looks over engineering for this exercise.
  2. BillGenerator code ignores the non-available menu items and continue processing.
  3. A maximum £20 service charge will apply in any case.

Note

Kept both functions totalBillWithServiceCharge() and totalBill() available to public use

Test Specification

Cafe X menu consists of the following items:

  • Cola - Cold - 50p
  • Coffee - Hot - £1.00
  • Cheese Sandwich - Cold - £2.00
  • Steak Sandwich - Hot - £4.50 Customers don’t know how much to tip and staff need tips to survive!

Step 1 : Standard Bill

Pass in a list of purchased items that produces a total bill. e.g. [“Cola”, “Coffee”, “Cheese Sandwich”] returns 3.5

Step 2: Service Charge

Add support for a service charge :

  • When all purchased items are drinks no service charge is applied
  • When purchased items include any food apply a service charge of 10% to the total bill (rounded to 2 decimal places)
  • When purchased items include any hot food apply a service charge of 20% to the total bill with a maximum £20 service charge

cafe-billing's People

Contributors

vashistha avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.