Skip to content

Challenge 1. This is a Java program that converts Roman numerals to integers using a loop to iterate through each character in the input string and calculate the total value based on the values of adjacent characters. It defines a helper function to map each Roman numeral character to its corresponding integer value.

Notifications You must be signed in to change notification settings

KavidiDeSilva/romanToInteger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

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.

About

Challenge 1. This is a Java program that converts Roman numerals to integers using a loop to iterate through each character in the input string and calculate the total value based on the values of adjacent characters. It defines a helper function to map each Roman numeral character to its corresponding integer value.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages