Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

/** * The test class RomanNumeralsTest. * */ public class RomanNumeralsTest exte

ID: 3584350 • Letter: #

Question

/** * The test class RomanNumeralsTest. * */ public class RomanNumeralsTest extends junit.framework.TestCase { /** * Default constructor for test class RomanNumeralsTest */ public RomanNumeralsTest() { } /** * Sets up the test fixture. * * Called before every test case method. */ protected void setUp() { } /** * Tears down the test fixture. * * Called after every test case method. */ protected void tearDown() { } public void test_1() { RomanNumerals romanNum1 = new RomanNumerals(); assertEquals("I", romanNum1.toRoman(1)); } public void test_3() { RomanNumerals romanNum1 = new RomanNumerals(); assertEquals("III", romanNum1.toRoman(3)); } public void test_8() { RomanNumerals romanNum1 = new RomanNumerals(); assertEquals("VIII", romanNum1.toRoman(8)); } public void test_27() { RomanNumerals romanNum1 = new RomanNumerals(); assertEquals("XXVII", romanNum1.toRoman(27)); } public void test_2011() { RomanNumerals romanNum1 = new RomanNumerals(); assertEquals("MMXI", romanNum1.toRoman(2011)); } public void test_44() { RomanNumerals romanNum1 = new RomanNumerals(); assertEquals("XVIV", romanNum1.toRoman(44)); } public void test555() { RomanNumerals romanNum1 = new RomanNumerals(); assertEquals("DLV", romanNum1.toRoman(555)); } public void test500() { RomanNumerals romanNum1 = new RomanNumerals(); assertEquals("D", romanNum1.toRoman(500)); } }

There are two errors in the code above;

1)study the given code, identify why the two tests fail, and correct the code.

2)On studying the code further, you will notice a few more bugs/limitations in the provided code (i.e. the provided code will not give the correct Roman numeral conversion for some numbers). Identify them and correct the code to handle those situations also.

3)Also, the test suite itself has a bug, i.e. it will flag an error in a particular case even when the code gives the right answer. Identify that situation and correct it.

4)Add five more tests to RomanNumeralsTest to give you confidence that all numbers between 1 and 3,000 will be converted correctly.

By the end of this assignment you will have code that converts from Arabic numerals to Roman numerals which handles all possibilities and is fully tested by an additional five tests (hence, a total of 13 tests: eight we provide and five you write).

Explanation / Answer

did not understand