# Lab 3 Roman Numerals

###### Due Oct 2

Write a program that accepts a year written as a four-digit Arabic (ordinary) numeral and outputs the year written in Roman numerals. Important Roman numerals are:

 Symbol Value I V X L C D M 1 5 10 50 100 500 1,000
Recall that some numbers are formed by using a kind of subtraction of one Roman “digit”; for example, IV is 4 produced as V minus I, XL is 40, CM is 900, and so on. A few sample years: MCM is 1900, MCML is 1950, MCMLX is 1960, MCMXL is 1940, MCMLXXXIX is 1989. Assume the year is between 1000 and 3000. Your program should include a loop that lets the user repeat this calculation until the user says she or he is done.

You can explore and test Roman Numerals here: Roman Numerals Converter

Your program should give an appropriate error if the input is not a valid four-digit year between 1000 and 3000.

###### Below is a sample run:
Enter a year between 1000 and 3000 (0 to end): 1957
Year 1957 is MCMLVII in Roman numerals

Enter a year between 1000 and 3000 (0 to end): 2018
Year 2018 is MMXVIII in Roman numerals

Enter a year between 1000 and 3000 (0 to end): 265

Enter a year between 1000 and 3000 (0 to end): 1245
Year 1245 is MCCXLV in Roman numerals

Enter a year between 1000 and 3000 (0 to end): 2999
Year 2999 is MMCMXCIX in Roman numerals

Enter a year between 1000 and 3000 (0 to end): 1000
Year 1000 is M in Roman numerals

Enter a year between 1000 and 3000 (0 to end): 0

###### Turn in runs for the following trial data:
1. 1650
2. 2033
3. 1999
4. 2001
5. 2736
6. A year that is too small
7. A year that is too large

Completion of all functional requirements 60
Code broken up in fsmall, single function unctions 10
Appropriate code formatting 5
Meaningful identifier names (variables, functions) 10
Comments at the top, and on all functions 5
Document with a run of all trial cases 10
Total 100

Solution
Edit | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | More topic actions
Topic revision: r4 - 2018-10-01 - JimSkon

 Home Main Web P View Edit Account
Copyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback