This website is preserved for historical and scholarly reference and is no longer actively maintained.
                         CpSc 210, Section 1
                             Assignment 2 
                          January 28, 2002 


Due:  Wednesday, February 6 at 11:59 p.m.  

Assignment:  Finding the Roman number equivalent to an integer


Total point value of assignment:  100 points
Not accepted late.

This assignment is to be done INDIVIDUALLY.

Assignment:  Design and implement a class, Roman, which must be stored in a
     file named Roman.java.  (20 point deduction for failure to name file
     correctly!)  Roman.java must contain at least the following method:

          public static String translate ( int number )
          // Pre:  0 < number <= 3000
          // Post:  Returns a String holding the Roman numeral 
          //        equivalent of number.

     You may include any additional methods you need.  Additional methods
     should be private instead of public.

You may assume the following:

	I (capital letter I) is one
	V (capital letter V) is five
	X (capital letter X) is ten
	L (capital letter L) is fifty
	C (capital letter C) is one hundred
	D (capital letter D) is five hundred
	M (capital letter M) is one thousand

	Strings will be equivalent to numbers in the range 1 .. 3000
    Since there is no zero, the empty String is not allowed.

 	Sample results are:
	translate ( 6 ) will return "VI".
	translate ( 8 ) will return "VIII".
	translate ( 9 ) will return "IX".
	translate ( 12 ) will return "XII"
	translate ( 19 ) will return "XIX"
	translate ( 30 ) will return "XXX"
	translate ( 49 ) will return "XLIX"
	translate ( 85 ) will return "LXXXV"
	translate ( 2001 ) will return "MMI"
	translate ( 2450 ) will return "MMCDL"

The method translate should work for any String number in the range 
1 .. 3000 inclusive.  Code that contains specific tests for the above
above values such as "if ( 49 == number ) ... " will be considered
as NOT a reasonable attempt to solve the problem.

ROMAN NUMERATION. (from page 91, Mathematical Ideas by Miller and Heeren)
"You are probably familiar with the Roman numeration system, which
 is still used today, mainly for decorative purposes, on clock faces, for
 heading numbers in outlines, for chapter numbers in books, and so on.
  What are the characteristics of the Roman method?  Apparently, base 10
 appealed to them also, but they introduced "extra" symbols to reduce the  
number of repetitions within a group.  The Roman symbol for 1 was similar
 to that of the Egyptians, with repetitions of this symbol used for 2,
 and 3.  Instead of continuing in this way up to 9, though, they introduced
 a distinct symbol for 5.  Likewise, their symbol for 10 was repeated for
 20 and 30, but a distinct symbol denoted 50.  Other symbols denoted 500,
 5000, 50,000, and 500,000.  Roman numeration is like a base 10 simple
 grouping system with a secondary base 5 grouping.  More symbols had to be
 used than in a pure simple grouping system, but the necessity of
 repetition was reduced.


"The Romans also saved space by using subtractiion. A symbol to the left of another symbol of larger value indicated that the smaller value was to be subtracted from the larger value on the right. For example, 9 was written IX (10 minus 1) rather than VIIII (5 plus 4). The same method was often used to write 4 as IV rather than IIII. ..."
Note that more than a single symbol is never subtracted.  For example, VIIi
is always used to represent eight.  IIX is never used to represent 8.

Grading Rubric:

	10 pts. reasonable attempt to solve problem as assigned
	10 pts. also compiles
	10 pts. style standards (includes clarity)

    The following 70 points are available only for code that compiles 
    and runs without error. 

    50 pts. works for your test driver, which includes all examples above.
    15 pts. works for our testDriver 
     5 pts. elegance of algorithms used in solution


Other requirements: The first operation of your main program must be to print "CPSC 210", your name, the assignment number, and a brief description of the assignment.

Follow the style standards to be found on your instructor's web page for CPSC 210. Submit your program using the handin command. There is a link to the handin description on the CPSC 210 lab page (www.cs.clemson.edu/~lab210).