Skip to content

Latest commit

 

History

History
9 lines (5 loc) · 678 Bytes

README.md

File metadata and controls

9 lines (5 loc) · 678 Bytes

romanToInteger

Challenge 1.

This is a Java program that converts Roman numerals to integers.

It defines a class called "romanToInteger" with a method called "romanToInt" that takes a string of Roman numerals as input and returns the corresponding integer value. The program uses a loop to iterate through each character in the input string and calculate the total value by comparing adjacent characters and adding or subtracting their values based on their relative order.

Finally, it returns the total value as the output. The program also defines a helper function called "valueOfRomanChar" that maps each Roman numeral character to its corresponding integer value.