Skip to content
This repository has been archived by the owner on Nov 11, 2019. It is now read-only.

hitsounds/upside-down

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Roman Numerals Calculator CodeFactor

What?

This is a software development task and an implementation task. Roman numerals continue to be used for certain limited purposes such as copyright dates. The symbols used are I=1, V=5, X=10, L=50, >C=100, D=500 and M=1000. One definition of Roman numbers is the letters must be in descending order of value, the value of the number is the sum of all the letters, a letter must not be repeated if it can be replaced by another letter. This is known as the additive rule and is the only rule to be used in this question. Note that Roman numbers are always integers and >cannot have fractional values. For example:

MCX = 1000 + 100 + 10 = 1110

MXC is invalid because of wrong order

IIII = 1 + 1 + 1 + 1 = 4

IIIII is invalid because it can be replaced with V

A manufacturing company wishes to make a new calculator that allows a user to input two numbers using Roman numerals and displays the >numbers in both Roman and Arabic decimal forms. The calculator then allows a user to add or subtract the two numbers and again displays >the result in both Roman and Arabic decimal forms. The calculator must allow a user to enter two numbers in Roman numerals, according to the additive rule, each up to a maximum value of MMMM (4000), prevent the user entering an invalid Roman numeral, display the numbers entered in both Roman numerals and in their Arabic decimal equivalent, allow the user to enter an operator for addition or subtraction, prevent the result of a subtraction being zero or a negative number, display the result of the calculation in both Roman and Arabic decimal forms, allow the user to clear all displays. Create a basic interface for this. This can be on any platform

EXTENSION:

The manufacturing company would like the calculator to be able to cope with numbers with up to TWO decimal places in Roman numerals. >E.g. MCV.XI = 1000 + 100+5 . 10 +1 = 1105.11

Describe and write an Algorithm to cater for this.