Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment, your task is to write a program the converts Arabic numerals (the kind we usually use) to Roman numerals. Your program should

In this assignment, your task is to write a program the converts Arabic numerals (the kind we usually use) to Roman numerals. Your program should be able to handle integers between 1 (the Romans had no way to represent zero, negative, or decimal numbers) and 3999. You should display an error message for numbers outside of this range. Allow the user to continue converting values until the enter -1 to quit. The code for doing the conversion should be contained within a method with the following signature:

public static String arabicToRoman(int arabic);

Part of the task of writing good code that is often overlooked in school is testing your code in a logical way. When you test code, it is important to have tests that cover each of the following situations:

normal case a standard instance of the problem that tests the basic operation on normal inputs

invalid case tests that the program responds appropriately to various types of invalid inputs

boundary case a tricky instance of the problem that tests the operation on inputs that have to be handled in a special way

At the bottom of your code in this assignment, include a comment that explains your test plan the inputs you chose for each case, why you chose them, and the results produced by your program. Do NOT write a description of your development or debugging process. Instead, provide a list of normal, invalid, and boundary test cases and the expected results

The Romans thought it would be easier to read if they did not have the same numeral four times in a row, so instead of IIII, the number 4 is written IV. Similarly, 9 is written IX instead of VIIII. 99 is XCIX. Please see Wikipedia if you need more information about Roman numerals. Hint: If you can get your program to produce the Roman numerals, but you are having trouble with the rule about not having four of the same character in a row, you might want to consider using the replaceAll method of the String class to search for the invalid patterns and replace them with the correct pattern

Sample output: Enter an integer (-1 to quit): 14

XIV

Enter an integer (-1 to quit): -2

The Romans did not have a way to represent negative numbers or zero.

Enter an integer (-1 to quit): -1

Goodbye!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

How do cultural norms affect our behaviorpg18

Answered: 1 week ago

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago