Skip to content

YourYoungerBrothersPug/Rumerals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rumerals

Project Requirements

Convert Integer to Roman Numerals

This API takes a positive integer between 1 and 3999 (both included) as its parameter and returns a string containing the Roman Numeral representation of that integer.

Modern Roman numerals are written by expressing each digit separately starting with the leftmost digit and skipping any digit with a value of zero. There cannot be more than 3 identical symbols in a row.

In Roman numerals:

  • 2022 is written as 2000 = MM, 20 = XX, 2 = II resulting in MMXXII
  • 1990 is written as 1000 = M, 900 = CM, 90 = XC resulting in MCMXC
  • 2008 is written as 2000 = MM, 8 = VIII resulting in MMVIII
  • 1666 uses each Roman symbol in descending order MDCLXVI
  • 3999 is written as MMMCMXCIX

Example:

Input Output
1 I
1000 M
1666 MDCLXVI
Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1,000

Convert Roman Numerals to Integer

There is also an endpoint that takes a Roman Numeral string and returns its integer value.

Example:

Input Output
MMXXI 2021
MMMCMXCIX 3999

Quick Start Guide

In the root of the directory, run docker compose up. This will pull the build from Docker Hub and run it locally in your Docker environment.

The command exposes port 8080 and shows Swagger UI at http://localhost:8080/swagger/index.html where you can call the API.

Alternatively, you can run the project locally and use Swagger UI, or the supplied Rumerals.Api.http file to call the API (the default port for this file matches when you run the project with the http profile).

Test Suite

There is a test suite that tests the conversion of valid and invalid conversions to Roman Numerals, and valid conversions from Roman Numerals.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published