Code Monkey home page Code Monkey logo

java-test's Introduction

Java Exercise

Running the Application

To run the application:

mvn clean package -DskipTests

mvn exec:java

After this just follow the instructions. The output from the application is printed to the command line.

Running Tests

To run tests:

mvn clean test

Notes

Everything executes successfully on my mac - macOS Mojave 10.14.6. - Java version: 11.0.1. However there is no functionality used that is not present in JDK 8.

Instructions

  1. Please fork this repository and work on your fork. https://help.github.com/en/articles/fork-a-repo
  2. Commit changes frequently so that we can review your progression with you later. https://crealytics.com/blog/5-reasons-keeping-git-commits-small/
  3. You should use a recognised build tool, e.g. gradle, maven...
  4. We are currently using open JDK 8u181. But please use the JDK you think is most appropriate to demonstrate your skillset.
  5. We don't expect 100% code coverage, we expect well tested code. https://medium.com/@nicklee1/why-test-code-coverage-targets-are-a-bad-idea-1b9b8ef711ef
  6. Any other tools or libraries used must be freely available. Any third-party jars must be accessible via maven central.
  7. The specification is below.

Specification

A local shop, Henry’s Grocery, has asked you to author an IT solution for them to price up a basket of shopping for their customers.

Henry’s Grocery, currently only stocks four items and has two promotions. These are as follows:

Stock Items

product unit cost
soup tin 0.65
bread loaf 0.80
milk bottle 1.30
apples single 0.10

Discounts

the offer valid from valid to
Buy 2 tins of soup and get a loaf of bread half price yesterday for 7 days
Apples have a 10% discount from 3 days hence until the end of the following month

Inputs

All basket items added via the command prompt.

Outputs

All outputs must print to the command line.

Tests

  • Price a basket containing: 3 tins of soup and 2 loaves of bread, bought today,
    • Expected total cost = 3.15;
  • Price a basket containing: 6 apples and a bottle of milk, bought today,
    • Expected total cost = 1.90;
  • Price a basket containing: 6 apples and a bottle of milk, bought in 5 days time,
    • Expected total cost = 1.84;
  • Price a basket containing: 3 apples, 2 tins of soup and a loaf of bread, bought in 5 days time,
    • Expected total cost = 1.97.

java-test's People

Contributors

markgaywood 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.