Create a java program that will take a positive number between 1 and 3999 inclusively and return the Roman Numeral equivalent of that number. For a reminder on roman numerals in case you are not familiar with them:   The Roman Number system: I = 1 , C = 100, V = 5, D = 500 , X = 10, M = 1000, L=50   Numbers are formed according to the following rules: 1) Only numbers up to 3999 are represented. 2) As in the decimal system, the thousands, hundreds, tens and ones are expressed separately. 3) The numbers 1 to 9 are expressed as: I 1 VI 6 II 2 VII 7 III 3 VIII 8 IV 4 IX 9 V 5 4) An “I” preceding a “V” or “X” is subtracted from the value, 5) You can never have more than three Is in a row 6) Tens and hundreds are done the same way except that letters X, L, C and C, D, M are used instead of I, V, X respectively. 7) The thousands digits is M for 1000, MM for 2000 and MMM for 3000.   General description of the programs behavior: - Have a welcome message explaining to the user the purpose of this program - Request the year to be converted from the user. - Determine if the year is a valid one (between 1 and 3999 inclusive). If it is, continue to the conversion and print out the Roman equivalent. If it isn't, send the user a message indicating that it is not a valid year, and terminate the program. - Send a farewell message, so that the user knows that the program has terminated normally. Try and make your program as efficient as possible. (The idea is not to have a series of simple ifs one after the other.) You can use simple if/else, nested selection and switch statements. Loops are not permitted.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 15PE
icon
Related questions
Question

Create a java program that will take a positive number between 1 and 3999 inclusively and return the Roman Numeral equivalent of that number. For a reminder on roman numerals in case you are not familiar with them:

 

The Roman Number system:

I = 1 , C = 100, V = 5, D = 500 , X = 10, M = 1000, L=50

 

Numbers are formed according to the following rules:

1) Only numbers up to 3999 are represented.

2) As in the decimal system, the thousands, hundreds, tens and ones are expressed separately.

3) The numbers 1 to 9 are expressed as: I 1 VI 6 II 2 VII 7 III 3 VIII 8 IV 4 IX 9 V 5

4) An “I” preceding a “V” or “X” is subtracted from the value,

5) You can never have more than three Is in a row

6) Tens and hundreds are done the same way except that letters X, L, C and C, D, M are used instead of I, V, X respectively.

7) The thousands digits is M for 1000, MM for 2000 and MMM for 3000.

 

General description of the programs behavior:

- Have a welcome message explaining to the user the purpose of this program

- Request the year to be converted from the user.

- Determine if the year is a valid one (between 1 and 3999 inclusive). If it is, continue to the conversion and print out the Roman equivalent. If it isn't, send the user a message indicating that it is not a valid year, and terminate the program.

- Send a farewell message, so that the user knows that the program has terminated normally. Try and make your program as efficient as possible. (The idea is not to have a series of simple ifs one after the other.) You can use simple if/else, nested selection and switch statements. Loops are not permitted.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT