Coder Social home page Coder Social logo

cs-int-dev-rm's Introduction

Roman Numerals

The Romans wrote their numbers using letters; specifically the letters

  • 'I' meaning '1'
  • 'V' meaning '5'
  • 'X' meaning '10'
  • 'L' meaning '50'
  • 'C' meaning '100'
  • 'D' meaning '500'
  • 'M' meaning '1000'

There were certain rules that the numerals followed which should be observed:

  • The symbols 'I', 'X', 'C', and 'M' can be repeated at most 3 times in a row.
  • The symbols 'V', 'L', and 'D' can never be repeated.
  • The '1' symbols ('I', 'X', and 'C') can only be subtracted from the 2 next highest values ('IV' and 'IX', 'XL' and 'XC', 'CD' and 'CM').
  • Only one subtraction can be made per numeral ('XC' is allowed, 'XXC' is not).
  • The '5' symbols ('V', 'L', and 'D') can never be subtracted.

Examples

Roman Numeral Value
I 1
IV 4
V 5
VI 6
X 10
L 50
C 100
D 500
M 1000
MCMXLIV 1944
MCMXCIV 1994
MMVI 2006

Kata

Implement the public int convert(String value) method in RomanNumeralConverter.java

There is a test case RomanNumeralConverterTest.java which you may want to use.

cs-int-dev-rm's People

Contributors

peterrhysthomas avatar

Watchers

James Cloos avatar Pete Suggitt 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.