Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

Java Program 6

BunkerHillBroad
BunkerHillBroad 


use file Roman.java Write a program to read in a string of characters that represent a Roman numeral and then convert it to Arabic form (an integer). The character values for Roman numerals are as follows: Roman Symbol Value M 1000 D 500 C 100 L 50 X 10 V 5 I 1 Test your program with the following data: LXXXVII (87), CCXIX (219), MCCCLIV (1354), MMDCLXXIII (2673) and MCDLXXVI (1476). For your reference, the following link has a chart of many roman numerals: http://literacy.kent.edu/Minigrants/Cinci/romanchart.htm Note: You don't need to detect invalid Roman numerals like IVI and VC. Attachments
Tags Clarifications

Answers

Java Program 6 - Solution

mariobeka
mariobeka 



Implementation of the Roman java class as requested. Attachments
Roman.java (1 K) Download Preview
tempNumber; } return result; } private static int getArabicNumberFromRomanLetter(char letter) { switch (letter) { case 'M': return 1000; case 'D': return 500; case 'C': return 100; case 'L': return 50; case

Screenshots
Purchase Answer