This website is preserved for historical and scholarly reference and is no longer actively maintained.
CpSc 210, Section 1
Assignment 3
February 4, 2002
Due: Wednesday, February 13 at 11:59 p.m.
Assignment: Write a RomanNumeral class.
Total point value of assignment: 100 points
Not accepted late.
This assignment is to be done INDIVIDUALLY.
Assignment: Design and implement a class, RomanNumeral, which must be stored in
a file named RomanNumeral.java. (20 point deduction for failure to name
file correctly!) RomanNumeral.java must contain at least the following:
public class RomanNumeral
{
// instance variable(s)
// constructors
public RomanNumeral ( int number )
public RomanNumeral ( String numeral )
// methods
public String toString ( )
// post: returns a String representation of the Roman numeral
public boolean equals ( String otherNumeral )
public boolean equals ( int otherNumeral )
public void inc ( )
// post: 1 has been added to value of this RomanNumeral
public void dec ( )
// post: 1 had been subtracted from value of this RomanNumeral
public static void main ( String [ ] args )
// test driver for RomanNumeral class
{
You may include any additional methods you need, such as the method you
wrote for Assignment #2. Such methods must be declared private instead
of public.
Your initial decision is how to store the value of the Roman numeral
in an instance variable. Obvious possibilities are to store it as
an integer or to store it as a String. DO NOT STORE IT AS BOTH.
CHOOSE ONE REPRESENTATION ONLY. The problem with using more than
one representation for the same data is integrity. If you were to use
two (or more) representations for the same information, then every time
one representation was changed the other must be changed also.
Grading Rubric:
10 pts. reasonable attempt to solve problem as assigned --
includes storing only one representation of numeral value
10 pts. also compiles
10 pts. style standards (includes clarity)
The following 70 points are available only for code that compiles
without error. We will use our test driver..
15 pts. constructors
15 pts. equals methods
15 pts. inc and dec
5 pts. toString
15 pts. correctness of implementation
(both correctness of individual methods and interaction of methods)
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).