Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8167107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:05:57+00:00 2026-06-06T20:05:57+00:00

I would like to take the Roman Numeral value stored in the object and

  • 0

I would like to take the Roman Numeral value stored in the object and convert it back to integer, long, float, and double values. I really don’t know where to start, other than creating the appropriate methods. Can anyone offer some advice?

http://pastebin.com/sqwdhbtu

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T20:05:58+00:00Added an answer on June 6, 2026 at 8:05 pm

    Your question seems to be how to convert a roman numeral to integer. In that case all you need is one function to parse the string from left to right and add the result together while looking for smaller numbers that should be subtracted.

    class RomanNumeral{
      String roman;
    
      public RomanNumeral(String roman){
        this.roman = roman;
      }
    
      public RomanNumeral Clone(){
        return new RomanNumeral(this.roman);
      }
    
      public int GetValue(){
        int sum = 0;
        int carry = 0;
        for(int i = 0; i< roman.Length;i++)
        {
         if(i<roman.Length-1){
           if(GetRomanValue(roman[i])>GetRomanValue(roman[i+1])){
              sum += GetRomanValue(roman[i]) - carry;
              carry = 0;
           }
         else carry = GetRomanValue(roman[i]);
        }
        else sum += GetRomanValue(roman[i]) - carry;
      }
     }
    
      int GetRomanValue(char c)
      {
        switch(c){
         case 'I': return 1;
         case 'V': return 5;
         //and so on...
        }
       }
    }
    

    Once you have the integer you can cast it to the other numeric types.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to take the value of a spinner and convert it to
I would like to take subtotal of table in matlab. If the values of
I would like to take values that are calculated in IML to be used
I would like to take blank secure stock paper and convert it in to
I would like to take snippets of text and convert them, programmatically, to be
I would like to take this formula: and convert it into java code. I
I would like to take some variables, listed here; double dBench = (((Math.floor((dWeight*.664)/10))*10)-10)+dPush; double
I would like to take a time stamp (e.g. 1263531246) and convert it to
I would like to take an object and remove some methods from it. i.e.
Long story short, I would like to take my usercontrols that are loaded dynamically

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.