+44 (0)207 0169342
info@parkerfox.co.uk

Case Studies

Recent Projects

Energy Dynamics

Silverpicks

My Playdisc

Music Data Research

TradeX

Roman Numerals

This looks simple, but is a little more tricky than it might seem. There are many ways to implement it.

Specification

Write a console application to perform two functions:

1) string int2roman(int i)

  • should return the equivalent roman numeral if 0 < i < 10000
  • otherwise should return a blank string
  • you may use helper functions

2) int roman2int(string s)

  • should return -1 if the s is not a valid roman numeral.
  • should return the integer equivalent of the roman numeral if s is a valid roman integer
  • you may use helper functions

Delivery

Should be delivered as a zip file containing an executable console application along with its source.

Notes

  • Total time should be roughly 1/2 hour for question 1 and 3/4 of an hour for question 2.
  • Using the internet for research into the nature and rules of roman numerals is permitted, e.g. Wikipedia
  • Looking up algorithms or copying code from the internet is not permitted. We are aware of the particular material and plagiarism will count as a failure.
  • The roman numeral for 4 should be IV, not IIII (which is particular to clock makers). Ignore numerals such as V and X
Design and implementation: Parker Fox 2006