Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

EIU Java Program Worksheet

EIU Java Program Worksheet

EIU Java Program Worksheet

Description

Write a program to convert roman numerals into their arabic equivalent.

INPUT REQUIREMENTS

Read one or more roman numerals from standard input. Process one line at a time. Each input line contains only one roman numeral, starting in column one. Assume the characters are all upper case with no embedded blanks.

OUTPUT REQUIREMENTS

The arabic equivalent of each input roman numeral is displayed on standard output, starting in column one.

FUNCTIONAL REQUIREMENTS

Here are the arabic equivalents for roman symbols:

The “basic” roman symbols The “auxiliary” roman symbols

I X C M V L D1 10 100 1000 5 50 500

Convert the roman numeral to arabic processing the symbols from left to right according to the following rules:

1. A symbol following one of greater or equal value adds to its value. (E.g., XII = 12)
2. A symbol preceding one of greater value subtracts its value.(E.g., IV = 4; XL = 40)

ERROR HANDLING REQUIREMENTS

In each of the error conditions below, display the given message and skip the numeral and continue processing the next line.

“1 Invalid character in input. Valid characters are I,V,X,L,C,D,M.” RULE: Only the listed characters are valid.

“2 Invalid numeral: can’t subtract auxiliary symbol.” RULE: It is not permitted to subtract an “auxiliary” symbol. (CML, not LM = 950; XLV not VL, = 45).

“3 Invalid numeral: two consecutive subtractions.” RULE: Can’t do two subtractions in a row, thus LIVX is illegal.

“4 Invalid numeral: additions don’t decrease.” RULE: Additions must decrease, as you go from left to right. Thus, each symbol added must have a value equal or less than the last symbol which was added. Thus, LIIX is wrong, cause we added L, added I, subtracted I, then try to add X.

“5 Invalid repetition of V, L or D”: RULE The symbols V, L and D are never repeated.

“6 Too long repetition”: RULE A symbol is not repeated more than three times.

“7 Wrong subtraction” RULE The symbol I can be subtracted from V and X only. The symbol X can be subtracted from L, M, and C only. The symbol C can be subtracted from D and M.

“8 Cannot subtract more than one from a particular symbol” RULE A symbol cannot be subtracted more than once from a particular symbol of greater value. In other words, we cannot repeat a symbol on the left side of a symbol. Eg, 98 is written as XCVIII and not as IIC.

Read a string from the keyboard that codifies a roman number and print on the screen either the arabic number that corresponds to it or the first rule number that is not observed in the string from the left to right. If more than one rule is not observed in the roman number you should print only ONE rule from the ones described above (1 to 8).

Explanation & Answer:

1 program
User generated content is uploaded by users for the purposes of learning and should be used following our honor code & terms of service.

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Essay Noon only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Essay Noon are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Essay Noon are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Essay Noon, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20