Coder Social home page Coder Social logo

best-practice-exam_ires_2023's Introduction

best-practice-exam_ires_2023

src.OldFashionPound

A library (package src.OldFashionPound) implementing the 4 arithmetic operations (sum, subtraction, multiplication and division) for pre-1970 UK prices.

Under the old money system of UK, before 1970, there were 12 pence in a shilling and 20 shillings, or 240 pence, in a pound. Thus, a price in th OldUK Money system was expressed in Pounds, Shillings and Pence.

For example "12p 6s 10d" is 12 Pounds, 6 Shillings and 10 Pence.

Sum and Subtraction should add or subtract two prices respectively.

Example SUM:                 

  • 5p 17s 8d + 3p 4s 10d = 9p 2s 6d

Example SUBTRACTION:              

  • 5p 17s 8d - 3p 4s 10d = 2p 12s 10d

Subtractions giving negative results are managed:

  • 5p 17s 8d - 5p 18s 8d = 0d (-1s 0d)

Multiplication and division will multiply or divide a price by an integer

Example MULTIPLICATION:        

  • 5p 17s 8d * 2 = 11p 15s 4d

Example DIVISION:

  • 5p 17s 8d / 3 = 1p 19s 2d (2p)

Another Example DIVISION         

  • 18p 16s 1d / 15 = 1p 5s 0d (1s 1d)

PART 2

Implements sequentials arithmetic operations with src.OldFashionPound

Example SUM:                 

  • 1p 1s 1d + 1p 1s 1d + 1p 1s 1d = 3p 3s 3d

PART 3

Create a command line interface that could read your operation in a specified format and be able to return the correct result

Usage

$ java -jar path/to/src.OldFashionPound-X.X.X.jar [expression]

Expression must follow one of this rule:

  • Xp Ys Zd [+|-] Ap Bs Cd
  • Xp Ys Zd [*|/] K

best-practice-exam_ires_2023's People

Contributors

e-manuele avatar davidemastroianni avatar mastroianni-davide 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.