Troubles in converting roman to arabic..pls HELP!!!

i have a code here in converting roman to arabic and vice versa. the roman to arabic method is properly giving the correct output, then the arabic to numeral methos is malfunction..what i want is the ROMAN to ARABIC only,,,but im confuse on what to delete/edit in this code...can u help me edit this??...pls??
here's the code...
import java.io.*;
public class Numerals
public static void main(String[] args) throws IOException
String input = null;
System.out.print("Enter either a Roman Numeral or number: ");
BufferedReader br2 = new BufferedReader(new InputStreamReader (System.in));
try {
input = br2.readLine();
catch (IOException e) {
e.printStackTrace();
System.exit( 1 ); // don't catch and just print - exit
try {
int number = Integer.parseInt( input );
System.out.println("number in roman numerals: " );
intToRoman(number);
catch(NumberFormatException nfe) {
System.out.println("roman numberal as a number: " + romanToInt(input));
//-------Convert Roman numeral to integer data---------
private static String romanToInt(String RN2)
RN2 = RN2.toUpperCase();
int [] RN = new int [RN2.length()];
for (int convert = 0; convert < RN2.length(); convert++)
if (RN2.charAt(convert) == 'M' || RN2.charAt(convert) == 'm')
RN[convert] = 1000;
else if (RN2.charAt(convert) == 'D' || RN2.charAt(convert) == 'd')
RN[convert] = 500;
else if (RN2.charAt(convert) == 'C' || RN2.charAt(convert) == 'c')
RN[convert] = 100;
else if (RN2.charAt(convert) == 'L' || RN2.charAt(convert) == 'l')
RN[convert] = 50;
else if (RN2.charAt(convert) == 'X' || RN2.charAt(convert) == 'x')
RN[convert] = 10;
else if (RN2.charAt(convert) == 'V' || RN2.charAt(convert) == 'v')
RN[convert] = 5;
else if (RN2.charAt(convert) == 'I' || RN2.charAt(convert) == 'i')
RN[convert] = 1;
else
RN[convert] = 0;
//--------Calculate the Roman Numeral---------
int y = 0;
int z = 0;
int Num = 0;
while (y < RN.length)
if ((y+1) != RN.length)
z = RN[y+1];
if (z > RN[y])
Num = Num + (z - RN[y]);
y++;
else
Num = Num + RN[y];
y++;
}//ends while
return(Integer.toString(Num));
}//ends romanToInt
// CODE TO TRANSLATE ROMAN NUMERAL TO NUMBER
private static void intToRoman(int Num2)
int r= 0;
String number = Integer.toString(Num2);
for ( r = 0; r < number.length(); r++)
//return(Integer.toString(number));
//System.out.println(Num3[r]);
} //ends intToRoman
}

ahhmm, i just want to delete the arabic to roman method...ahm, the program which i wanted is only the ROMAN to ARABIC...i want to dscard/disregard the ARABIC to ROMAN...
here's hte code:
import java.io.*;
public class Numerals
public static void main(String[] args) throws IOException
String input = null;
System.out.print("Enter either a Roman Numeral or number: ");
BufferedReader br2 = new BufferedReader(new InputStreamReader (System.in));
try {
input = br2.readLine();
catch (IOException e) {
e.printStackTrace();
System.exit( 1 ); // don't catch and just print - exit
try {
int number = Integer.parseInt( input );
System.out.println("number in roman numerals: " );
intToRoman(number);
catch(NumberFormatException nfe) {
System.out.println("roman numberal as a number: " + romanToInt(input));
//-------Convert Roman numeral to integer data---------
private static String romanToInt(String RN2)
RN2 = RN2.toUpperCase();
int [] RN = new int [RN2.length()];
for (int convert = 0; convert < RN2.length(); convert++)
if (RN2.charAt(convert) == 'M' || RN2.charAt(convert) == 'm')
RN[convert] = 1000;
else if (RN2.charAt(convert) == 'D' || RN2.charAt(convert) == 'd')
RN[convert] = 500;
else if (RN2.charAt(convert) == 'C' || RN2.charAt(convert) == 'c')
RN[convert] = 100;
else if (RN2.charAt(convert) == 'L' || RN2.charAt(convert) == 'l')
RN[convert] = 50;
else if (RN2.charAt(convert) == 'X' || RN2.charAt(convert) == 'x')
RN[convert] = 10;
else if (RN2.charAt(convert) == 'V' || RN2.charAt(convert) == 'v')
RN[convert] = 5;
else if (RN2.charAt(convert) == 'I' || RN2.charAt(convert) == 'i')
RN[convert] = 1;
else
RN[convert] = 0;
//--------Calculate the Roman Numeral---------
int y = 0;
int z = 0;
int Num = 0;
while (y < RN.length)
if ((y+1) != RN.length)
z = RN[y+1];
if (z > RN[y])
Num = Num + (z - RN[y]);
y++;
else
Num = Num + RN[y];
y++;
}//ends while
return(Integer.toString(Num));
}//ends romanToInt
// CODE TO TRANSLATE ROMAN NUMERAL TO NUMBER
private static void intToRoman(int Num2)
int r= 0;
String number = Integer.toString(Num2);
for ( r = 0; r < number.length(); r++)
//return(Integer.toString(number));
//System.out.println(Num3[r]);
} //ends intToRoman
}

Similar Messages

  • E72 UAE Map search shows only Arabic, Pls help to ...

    I have the issue with Maps, from the time i bot it. I have the map of UAE in my E72, when ever i search any place, the result shows only in Arabic. I need the search reasult in English. My phone language is English. I tried several time reinstallations of maps as well..  Pls somebody help me to make the search result available in English. That will a BIG help!!!
    for more info, 
    1. My Map ver is V3.04 - 0.1.26.113 and no avaliable update on Ovi Suite, as am checking daily. 
    Pls pls help me

    @Swaroopt
    Depends upon your localisation, this is result from UK:
    Happy to have helped forum with a Support Ratio = 42.5

  • Trouble Converting to Date..Pls Help....!

    Good day gurus!
    Can anyone help me figure out how to make an appropriate sql statement in converting a "char" datatype into a "date" datatype? To be more exact this database is actually a foxpro database (.dbf). I am migrating this one to oracle. My problem is one the fields there which is likely to be "date" datatype is declared "char" . So what im trying to do is fetch that column which is actually a "char" type and convert it to "date" type using sql query. Can somebody show me the right way? I just want to pick up only the latest date (60 days to current) in that field.
    heres an example.
    042807 - - > 04/28/07 or 04/28/2007
    Thanks in advance!
    Best Regards,
    JD

    Hi,
    Hope this example will help you
    SYS@bahamut> desc vd.t9
    Name Null? Type
    TGLD DATE
    SYS@bahamut> insert into vd.t9 select to_date('04012008','dd/mm/yyyy') from dual;
    1 row created.
    SYS@bahamut> commit;
    Commit complete.
    SYS@bahamut> select * from vd.t9;
    TGLD
    04/01/2008
    cheers

  • Have trouble downloading premiere pro trial version - pls help

    I have cs6 design and web suite - I am not on cloud.....
    when downloading i get in the middle of it a message telling me that the application manager is corrupt. Any ideas what is wrong?
    thanks
    Bee

    CS6 Trial Download - where can I find it?
    http://forums.adobe.com/message/5459679#5459679
    CS6 - Buy the Perpetual License version (Not Creative Cloud rental)
    http://www.adobe.com/products/catalog/cs6._sl_id-contentfilter_sl_catalog_sl_software_sl_c reativesuite6.html?promoid=KFPMZ
    To buy an upgrade instead the of full version, click the buy button
    then select 'I want to buy: Upgrade' instead of 'Full'.
    CS5 and CS5.5 Products are eligible for upgrade to CS6.

  • Any java experts pls help me in converting attribute to XML formats

    Pls help me oh my god i am a newbie here and i am given this project.
    I had just written a XML doc. which looks like this
    <ConsumerTransfer>
    <TransactionId>
    123:123
    </TransactionId>
    <Billingoption>
    cash
    </Billingoption>
    </ConsumerTransfer>
    I need to make this to attributes like
    private String TransactionId()
    private String BillingOption()
    and so on.....
    I need to convert this attributes to XML format
    can any show me an example or the source codes for this
    Really, I appreciate it.
    JimmyKnot

    For such node level operations I think that DOM would be a good idea. So here you go. Look for some nice tutorial for DOM and you got it.
    salut

  • I have iPhone 6,  8.3. I cannot use bluetooth at all from my device, even to connect my macbook pro. I did all the recommended trouble shooting such as  reboot and reset network settings. but it does not recognise any bluetooth device. Pls help.Thank

    I have iPhone 6,  8.3. I cannot use bluetooth at all from my device, even to connect my macbook pro. I did all the recommended trouble shooting such as  reboot and reset network settings. but it does not recognise any bluetooth device. Pls help.Thank you.

    See iPhone BT profile on what can be connected/paired:
    iOS: Supported Bluetooth profiles - Apple Support
    And BT troubleshooting:
    iOS: Troubleshooting Bluetooth connections - Apple Support

  • After i erased whole data from the ipod touch 3rd gen. when i put back to sync it. it says in the windows connect to itunes, which i did,i also installed new itunes but still it doesnt recognise . pls help me if u have gone thru same trouble like me.

    after i erased whole data from the ipod touch 3rd gen. when i put back to sync it. it says in the windows connect to itunes, which i did,i also installed new itunes but still it doesnt recognise . pls help me if u have gone thru same trouble like me
    Thanks

    I do not understand what "it says in the windows connect to itunes" means?
    What is "it" and what is "windows"?
    Maybe:
    iOS: Device not recognized in iTunes for Mac OS X
    Or
    See
    iOS: Device not recognized in iTunes for Windows
    - I would start with
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    or                     
    Removing and reinstalling iTunes and other software components for Windows Vista, Windows 7, or Windows 8
    However, after your remove the Apple software components also remove the iCloud Control Panel via Windows Programs and Features app in the Window Control Panel. Then reinstall all the Apple software components
    - Then do the other actions of:
    iOS: Device not recognized in iTunes for Windows
    paying special attention to item #5
    - New cable and different USB port
    - Run this and see if the results help with determine the cause
    iTunes for Windows: Device Sync Tests
    Also see:
    iPod not recognised by windows iTunes
    Troubleshooting issues with iTunes for Windows updates
    - Try on another computer to help determine if computer or iPod problem

  • I have iPhone 4 factory unlocked. I was using it. But today suddenly it's showing no service. From 2 or 3 days. Pls help me!!! I m in trouble

    Pls apple expert help me. I was using iphone4 factory unlock.
    But today it's showing no service suddenly. From 2 or 4 days. Pls help I m
    In trouble!!!

    What do you mean by Factory unlock ?
    Unlocked iPhones are either sold by Apple with no carrier lock or the original carrier  has agreed to unlock the iPhone from their network

  • I can't update/downloads an app from app store by using by iphone 4s. The icon will change to blank keep waiting, this problem was trouble me for 1 week. pls help me.I try all the method (reset/change date setting)no help my network is ok.

    I can not update/download an app from app store by using my iphone 4s. I try every method by re-setting date/time and reboot the phone etc.NO Help.
    The icon will change to blank keep waiting & can not go in & use in. Anyone have solution for this. pls help me...tks

    .local indicates local activity by the computer host Williams-macbook-pro.local=hostname@domain . The UID of 501 is the standard UID of a local computer administrator.
    Copy and paste this little script in your terminal:
    if [ "SSH_CONNECTION ]; then
         echo I am remote
    else
         echo I am local
    fi
    A return of "i am local" ensures there is no remote connection to your machine (through SSH).
    In the future, to avoid remote entry, I would recommend not posting your IP address though.

  • Hiii, i have m rows & n columns in my table..how to convert it into m columns & n rowa by using sql..pls help me...thanks.

    hiii,
    I have a table which has 14 rows & 8 cols.
    I want covert it into 14 cols & 8 rows,
    by using sql how to do it..pls help me.

    Oracle Database Search Results: pivot

  • Not getting PO printed while using bursting pls help

    Hi All,
    Working on converting PO report to XML. While using bursting to print the pdf file the document is not sent to the printer..
    But in the output file of the "XML Publisher Report Bursting Program" getting success.
    Not sure why report output is not sent to the printer.
    Pls help......
    Thanks
    Rajesh
    Edited by: Badsha on Jun 17, 2010 2:19 AM

    Hi...Please check the Burst Control file with the printer & IP details.
    Look for the file below.
    <?xml version="1.0" encoding="UTF-8"?>
    <xapi:requestset xmlns:xapi="http://xmlns.oracle.com/oxp/xapi">
    <xapi:globalData location="stream">
    </xapi:globalData >
    <xapi:request select="/DATA/LIST_DEPT/DEPT/LIST_EMPLOYEE/EMPLOYEE">
    <xapi:delivery>
    <xapi:email server="${EMAIL_SERVER}" port="${EMAIL_PORT}"
    from="${FROM_EMAIL_ADDRESS}"
    reply-to ="${REPL_TO_ADDRESS}">
    <xapi:message id="email1" to="${TO_EMAIL_ADDRESS}" cc="${CC_EMAIL_ADDRESS}"
    attachment="true" content-type="html/text"
    subject="Employee Report for Empno ${EMPNO}">
    Dear ${ENAME}, Please review the attached document.</xapi:message>
    </xapi:email>
    <xapi:filesystem id="file1"
    output="C:\burst\sample\${EMPNO}_${ENAME}_${MGR}_PRINT.pdf"/>
    <xapi:print id="print1" printer="${PRINT_URL}" copies="2"
    orientation-requested="3" />
    </xapi:delivery>
    <xapi:document key="${EMPNO}"
    output-type="pdf" delivery="email1">
    <xapi:template type="rtf" location="${TEMPLATE_LOC}"
    filter=".//EMPLOYEE[DEL_CHANNEL='EMAIL']" >
    </xapi:template>
    </xapi:document>
    <xapi:document key="${EMPNO}" output-type="pdf" delivery="print1">
    <xapi:template type="rtf" location="${TEMPLATE_LOC}"
    filter=".//EMPLOYEE[DEL_CHANNEL='PRINT']" >
    </xapi:template>
    </xapi:document>
    <xapi:document key="${EMPNO}" output-type="pdf" delivery="file1">
    <xapi:template type="rtf" location="${TEMPLATE_LOC}"
    filter=".//EMPLOYEE[DEL_CHANNEL='FILE_SYSTEM']" >
    </xapi:template>
    </xapi:document>
    </xapi:request>
    </xapi:requestset>
    check the printers setting as required....aslo check what printer you are using for pdf printing...Pasta Printing??
    Thanks
    Ratnesh

  • Can't import video (.mp4) to itunes 10.5, pls help

    I can't import video (.mp4 & .mov) to itunes 10.5.2.11 (can't both drag & down and add file to library).
    I searched many ways to solve in google with myself , but still not work
    Pls help -.-"

    MOV is a container format which may contain all kinds of codec, while iTunes only import MOV whose video codec is DV, MPEG-2, MPEG-4, H.264, or AIC.
    Even if the MOV meet the above requirement and supported and playable in iTunes, it will still fail to sync to iPod/iPad/iPhone/Apple TV if the MOV video does not fit the specification like resolution, bit rate, aspect ratio, size, and audio codec of the iPod/iPad/iPhone/Apple TV.
    In order to successfully import MOV to iTunes as well as sync MOV to Apple TV, iPod, iPhone, iPad, we have better convert the MOV video to a more compatible video format.
    Step by step guide on how to convert itunes unsupported mov to itunes supported one at How to Solve Can't Add MOV to iTunes to Play MOV in iTunes/iPod/iPad?

  • Pls help me. Could i get any service with my 1 month old iphone 5. My device can't recognize wifi devices.

    I bought this iphone 5 in Globe Telecome in the Philippines one month ago. I amvery worried coz of all the device here in our house this just the only one who can't connect to our home wifi. Even in our neighbors wifi. All our devices ipod 4 and 4s and laptop can connect except this iphone 5. I did all the trouble shooting but still it didn't work. Pls help me. I went to globe and it seems they can't help me with it. Is this covered by my warranty? Tnx

    Welcome to the Apple Support Communities
    Your log shows that graphic drivers have crashed, but there aren't any third-party extensions installed on your computer, so I suspect that there's a problem with the graphic card. I recommend you to take the Mac to an Apple Store to check if there's a hardware issue

  • Convert PDF with  Arabic  content to word /Excel .

    I have problem , I plan to buy Adobe acrobat  pro  for my ORG , The main target to buy it , to convert PDF a Arabic  content to word or Excel , I download trial version from Adobe acrobat pro  , and when i convert PDF English content  it's fine , but when i  convert PDF with Arabic content  , the result is bad the  word become letters and  the documents become not readable , Pleas  help me cause the main  target is convert Arabic PDF to Word .
    " the mean problem is  when i convert PDF with Arabic content to word the result is bad the   document become unreadable .
    thanks , wait for replay.

    HI,
    Adobe Acrobat is a special PDF viewer which is technically develop for the whole world to read any PDF file which a user wants to read. It's basic languages are:
    English (US)
    English (UK)
    Arabic
    Italian
    Japanese
    Spanish
    German
    But when you going to export the PDF file the arabic language will not support.
    Regards,
    Florence

  • Error in Dictionary DC deployment (URGENT Pls help)

    Hi experts,
    I am getting following error while deploying the Dictionary DC.
    I made changes in one database table (changing field length, added new columns).
    It got builtr successfully but deployment is giving errror, hence aborted.
    This is the trace m getting:-
    Pls pls help as soon as possible...
    May 5, 2008 4:38:28 PM Info: Starting: Update: Selected development component 'BshopDic'/'asianpaints.com'/'J2E_BODYSHOP_D'/'20080505171925' updates currently deployed development component 'BshopDic'/'asianpaints.com'/'J2E_BODYSHOP_D'/'20080505170547'.
    May 5, 2008 4:38:40 PM Info: <!LOGHEADERSTART/>
    May 5, 2008 4:38:40 PM Info: <!HELPManual modification of the header may cause parsing problem!/>
    May 5, 2008 4:38:40 PM Info: <!LOGGINGVERSIONhttp://1.5.3.7186 - 630/>
    May 5, 2008 4:38:40 PM Info: <!NAME[/usr/sap/J2E/JC00/SDM/program/log/jddilog20080505163828.log]/>
    May 5, 2008 4:38:40 PM Info: <!PATTERNhttp://jddilog20080505163828.log/>
    May 5, 2008 4:38:40 PM Info: <!FORMATTERhttp://com.sap.dictionary.database.dbs.DbTraceFormatter(%s %m %-30l %24d)/>
    May 5, 2008 4:38:40 PM Info: <!ENCODINGISO8859_1/>
    May 5, 2008 4:38:40 PM Info: <!LOGHEADEREND/>
    May 5, 2008 4:38:40 PM Info: 16:38:28 2008-05-05 dbs-Info: <<<<<<<<<<<<<< Table Deployment >>>>>>>>>>>>>
    May 5, 2008 4:38:40 PM Info: 16:38:28 2008-05-05 dbs-Info:
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: <<< Analyze table BC_DDDBRTH >>>
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: predefined action is: >>>null<<<
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: No action required for table
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: <<< Analyze table BC_DDDBTABLERT >>>
    May 5, 2008 4:38:40 PM Info: 1
    6:38:29 2008-05-05 dbs-Info: predefined action is: >>>null<<<
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: No action required for table
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: <<< Analyze table BC_DDDBRTH >>>
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: predefined action is: >>>null<<<
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: No action required for table
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: <<< Analyze table BC_DDDBRTX >>>
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: predefined action is: >>>null<<<
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: No action required for table
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: >>> Analyze tables from archive in database ORACLE
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: Next archive object : dbtables/BIT_AUTONUMBER.gdbtable
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: <<< Analyze table BIT_AUTONUMBER >>>
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: predefined action is: >>>null<<<
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: Action: CONVERT
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: Table has to be converted
    May 5, 2008 4:38:40 PM Info:
    May 5, 2008 4:38:40 PM Info: E R R O R ******* (DbModificationManager)
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Error: Table BIT_AUTONUMBER: Conversion currently not possible
    May 5, 2008 4:38:40 PM Info:
    May 5, 2008 4:38:40 PM Info: E R R O R ******* (DbModificationManager)
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Error: Table BIT_AUTONUMBER: Conversion currently not possible
    May 5, 2008 4:38:40 PM Info: 16:38:29 2008-05-05 dbs-Info: Next archive object : dbtables/BIT_BRAND.gdbtable

    Hi,
    It looks like the conversion of datatype is making issues.
    Either existing values are not complaint with the size changes you made.
    To resolve this either you remove the existing records and deploy.
    Take a backup of records and reimport later with default values to the newly added cols if they are not null.
    Regards
    Ayyapparaj

Maybe you are looking for

  • Blanket PO/invoice

    Hi all , I hv created a blanket PO, Account assignment  K and item category as B. maintained overall limit and expected value in the PO say, 1000 and 900 respectively. Now, when I do miro for the PO,which value should appear? Now it appears 0. why 0

  • After updating to iSO 6 no email access on my iphone 4

    After updating to iOS 6 on September 19, I have not been able to access my email.  Any suggestions?

  • Include format date inside If condition

    Hi, I need to format date which displays based on the IF condition. 1.<?xdoxslt:ifelse(Current_stub_number___Local_ID46<Stub_Total___Local_ID66,' ',G_L_Date___Local_ID18)?> above to display blank or date value G_L_Date___Local_ID18 based on condition

  • I am unable to imessage pictures

    I have an unlimited data plan and am connected to WIFI, I can send them as a text just not as imessage. Please Help

  • I need help.. important..?? please..

    dear all, i need to ask is i am building a main GUI that allows users to create a GUI themselves by adding objects and components from the menu at the top of the main GUI.. like frames and text areas.. But the important thing is.. when i am running t