Conversion program question

I have a JAVA question that may seem foolish, but I just can not figure it out! I have a Celsius to Fahrenheit conversion thing here, and it works, but I want to be intuitive and prompt the user for a second entry after the first conversion is made.
The code I have thus far is this:
import java.io.*;
public class TempConversion {
public static void main (String args[]) {
String input;
boolean badInput;
float tempC, tempF;
tempC = 0;
System.out.print("Enter a temperature in degrees Celsius : ");
do {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
input = in.readLine();
catch(IOException ex) { return;} try {
tempC = Float.valueOf(input).floatValue();
badInput = false;
catch (NumberFormatException ex) {
System.out.println(ex.getMessage() + " is an invalid number\nEnter another number : " );
badInput = true;
} while (badInput);
     tempC = Float.valueOf(input).floatValue();
     tempF = tempC * (9.0F/5.0F) + 32.0F;
System.out.println(" ");
System.out.println(tempC + " degrees Celsius = " + tempF + " degrees Fahrenheit");
Now I know there has to be a simple way to rerun the code after the system.out.println spits out the answer, but i can't figure out how to call the statement again. I played around a bit and was able to actually prompt for a second number, and actually input a number, but after that nothing happened. Any suggestions?
I really appreciate your help. Thanks a bunch!
-Chad

The whole conversion process needs to be in a while loop that asks if they want to convert another temperature at the end. Your input validation loop would be inside that loop, because you still need to validate for each conversion. Here's what I came up with based on your code:
import java.io.*;
public class TempConversion {
     public static void main (String args[]) {
          String input;
          boolean badInput;
          boolean keepGoing = true; // Flags when to stop asking.
          float tempC, tempF;
          tempC = 0;
          do { /* while (keepGoing) */
               do { /* while (banInput) */
                    System.out.println("Enter a temperature in degrees Celsius : ");
                    try {
                         BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
                         input = in.readLine();
                    } catch(IOException ex) { return; }
                    try {
                         tempC = Float.parseFloat(input);
                         badInput = false;
                    } catch (NumberFormatException ex) {
                         System.out.println(ex.getMessage() + " is an invalid number." );
                         badInput = true;
               } while (badInput);
               tempC = Float.valueOf(input).floatValue();
               tempF = tempC * (9.0F/5.0F) + 32.0F;
               System.out.println(" ");
               System.out.println(tempC + " degrees Celsius = " + tempF + " degrees Fahrenheit");
               System.out.println("Convert another temperature?  (Y/N)");
               try {
                    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
                    input = in.readLine();
                    // keepGoing will be false for any input except Y or y
                    keepGoing = input != null && input.equalsIgnoreCase("Y");
               } catch(IOException ex) { return; }
          } while (keepGoing);
}

Similar Messages

  • BW Upgrade "Execute the conversion programs for the product master "

    Hi BW Gurus,
                        We are in the process of upgrading BW 3.5 to BW 7.0. We did not get any conversion error in BW Dev but in BWQ we got error in one of ABAP program. The error message in log is :-
    "Value '######' of characteristic 0TIME is not a number with 000006 spaces"
    and job pertaining to the program is canceled in SM37.
    My question is, are we suppose to run any conversion program before or after the upgrade?
    Warm Regards,
    Anil

    Hi  Chandu,
    I am also looking for the same if u have fond a bapi for any other program please forward the information.
    Thanks & Regards,
    Basheer

  • Is there a FREE WMA conversion program?

    Hi everyone, quick question: Is there a WMA to MP3 Conversion program out there that is FREE? I've searched and searched but everything is a demo with an activation fee. If you know of any, can you give me the name and/or link please? Thank you VERY MUCH in advance.

    crafylady
    Welcome to the HP Community Forum.
    You listed your complete Product Information as Dell.
    So, assuming you mean a Dell Printer, the answer is No.  Smiling.
    If you mean a Dell computer and an HP Printer, then the Answser is a resounding, "Maybe", "Probably".
    The answer depends on the Printer Model and the Dell Operating System.
    You can find HP Printer Software installation instructions and help below.  Included is an example of the Scan a Document or Photo function that is relevant for many of the versions of the Printer software.
    Install Full Feature Software – Printer
    The printer's Support Pages also include your User Guide, videos, and lots of How-to links to useful documents.  There is also, in most cases for most printer modesl, an extensive "Troubleshooting" section.
    Click the Kudos Thumbs-Up to say Thank You!
    And...Click Accept as Solution when my Answer provides a Fix or Workaround!
    I am pleased to provide assistance on behalf of HP. I do not work for HP. 
    Kind Regards,
    Dragon-Fur

  • Stock upload conversion program

    Hello Experts,
    I have few questions below.
    What is the case that we require to do a BDC program for stock upload? What is the difference of using LSMW Vs BDC?
    I have about 500 materials and need to upload the stock into SAP from external excel file and need to move them into physical bins.
    Do I need to develop a conversion program for LSMW to full fill my requirement.I am asked to write a functional spec for stock upload.Please help..
    Do i need a seperate conversion program for stock transfer from 998 storage to physical bin?I should also print the SU labels during this program.
    Please explain the process.
    Thanks for your time in advance.
    Edited by: RKsap193 on Oct 13, 2008 12:28 PM

    If you send your personal email than i can send you the document with screen shot.
    Here is the complete step bu step process to load initial stock with LSMW
    you can use LSMW or BDC program
    LSMW can eb designed by analyst and BDC can be desined by ABAPer
    I did not find any documentation describing scenario of initial stock entry of material to HU & WM managed storage location. It inspired me to write this wiki.
    I use the following scenario of loading initial stock entry:
    u2022     Creation of inbound delivery using standard batch input import method - program RM07MMBL  with following tip:
    o   Input file from legacy system is prepared it such a way that one line contains information about one palette (or other packing materials) and storage bin coordinate.
    o   In the standard field MTSNR (Material slip) storage bin coordinates information is recorded.
    o   Field MTSNR is transferred to field LIKP-LIFEX (External Delivery ID)
    u2022     Creation of transfer order in reference to inbound delivery using batch input recording of transaction LT03
    o   Field NLPLA (Destination Bin) is read using simple ABAP code from delivery header - LIKP-LIFEX
    To create transfer order for inbound delivery in transaction LT03, material in inbound delivery must be packed, i.e. handling unit must be created. It can be archived by using an automatic packing functionality (packing instruction and packing instruction determination). 
    After TO confirmation the goods receipts can be posted for deliveries.
    Standard output can be generated for handling unit using message type E128 (EAN128 sticker). If needed storage bin information can be printed to simplify label  sticking on palette or other packing materials in the warehouse complex.
    In this scenario homogeneous materials are packed into one handling unit.
    Step 1: LSMW for initial stock entry in MM using 561 movement type:
    This is the well known standard LSMW procedure which use standard batch input import method - program RM07MMBL .
    1a. LSMW Process steps:
    I apply only following tip: in the standard field MTSNR (Material slip) storage bin coordinates information is recorded.
    1b. Maintain Source Fields LSMW process (step No. 3):
    1c. Input file - example:
    1d. Create batch input session LSMW (step No. 14).
    It is important to set "1" for Max. number of items. It ensures that one delivery is created per one input line.
    1e. Log sample from batch input session.
    1f. Inbound delivery monitor - transaction VL06I
    Selecting deliveries for Putaway you can control deliveries created in preceding step
    Each delivery is packed:
    and output - message type E128 is created:
    Step 2: LSMW for transfer order creation in reference to inbound delivery:
    This LSMW procedure is based on batch input recording of LT03 transaction. 
    2a. LSMW Process steps
    2b. Maintain Source Fields LSMW (step No. 3).
    Deliveries numbers can be simply generated to input file form inbound delivery monitor (see 1f step)
    There is no need to fill LGTYP (Storage type) and LGPLA (Storage section) because these fields are derived in LT03 transaction from storage bin - LGPLA (only if LGPLA is unique for all storage types and storage section - LAGP table).
    2d. Display Read Data LSMW (step No. 10)
    2e. Run Batch Input Session (step No. 14)
    Log from the batch input session:
    LT23:
    I have customized the system to automatically confirm TO. Finally all HU are put away.
    Tip & Trick
    You can confirm TO using RF devices (standard transaction LM02) while label sticking on a palette.
    Last step is to post GR for inbound deliveries which were put away. It can be done collectively in inbound delivery monitor by selecting deliveries for goods receipt: 
    Summary
    u2022     Easy to implement: two simple LSMW scenarios (one with few ABAP lines)
    u2022     Standard message type for label printout with information about storage bin coordination
    u2022     Possibility to analyze correctness of data migration in inbound delivery monitor before posting GR
    u2022     Possibility to confirm label sticking with RF transaction
    u2022     This scenario can be adapted for non homogeneous HUs

  • Conversion program for the open sales orders

    Hi ,
         How to proceed for writing a conversion program for open sales order ??
    Please share if 've any document or idea.
    LSMW object: 0090, Method: 0000
    Business Object : BUS2032, Method : CREATEFROMDAT2,
    Message Type: SALESORDER_CREATEFROMDAT2
    Basic Type: SALESORDER_CREATEFROMDAT202
    Regards,
    Jyoti Shankar

    Dear Saso,
    I think, instead using Report: VA05/ VA05N; its better to use Report: VL10C
    In this report, you will get all the Sales Orders along with Materials - relevant for open delivery, along with Open Qty. and various other options can be selected from "Change Layout - (Ctrlt+F8)".
    Best Regards,
    Amit
    Note: Don't maintain any Field-Entry (while executing the Report: VL10N; in order to list all Sales Orders. But, if you want to list Sales Orders based upon some criterias, maintain the Field-entries, as reqd.

  • VA41 Conversion program using BAPI's.

    Hi Friends,
    Could u please tell to develop/create conversion program to transfer data using BAPI's by using trx VA41(CREATE CONTRACT), I have Contract Document number(ID).
    This is one time conversion.
    Please tell step by step.
    Thanks in advance.
    Points rewarded for ur kind assistance.
    regard. Vishnu

    Hi Vishnu,
    There is a standard BAPI called <b>BAPI_CONTRACT_CREATEFROMDATA</b> available for VA41. Use that BAPI for the conversion. Get back to me if you got any doubts.
    Reward if useful.
    Thanks
    Aneesh.

  • Conversion program generated with errors

    in lsmw idoc method at the step 11 convert data iam getting error as conversion program generated with errors can some body help me .i assigned port ,partnertype and partner number and activated inbound processing but still getting this error.somebody pls help me its urgent.

    Hi Mamidi,
    Go to the LSMW you have choosen and if it is Recording Method you are getting this error.
    Select Goto-->Recordings.
    Select the Recording you have choosen in the Edit Mode.
    Click on the Defaults All Button and save the recording.
    Now go to the option Convert Data and check .
    You will receive a message ..Conversion program successfully generated.
    Thanks,
    Sri

  • Having a problem converting a PDF file to Words with Adobe's conversion program.

    Having a problem converting a PDF file to Words with Adobe's conversion program.

    See https://forums.adobe.com/docs/DOC-2412
    If you need more help, please ask in https://forums.adobe.com/community/acrobatdotcom/

  • UTF8 encoding Issue in the conversion program

    Hi all,
    Our requirement is to get data from a file stored in application server and update the SAP database.
    The flat file has some special characters such as u2122, ® etc.
    In the conversion program, we are using the encoding format as UTF-8. This means it will only handle UTF-8 file ( byte order mark (BOM) 8).
    After running the conversion program, we came to know that the special character u2122 is getting replaced wtih #.
    And when we modified the format of flat file to UTF-8 instead of ANSI or UTF-16 or 32.
    We were able to get the trademark symbol in correct look in addition with other special characters.
    Since this involves a manual of processing modifying the flat file to UTF-8 format and then running the conversion program for getting all the special characters in good look, we are thinking to make this process "automatic" in the conversion program itself i.e. whatever the format of flat file may be, we would convert that file to UTF with BOM 8 format and then go ahead with the next updating processes.
    So, can anybody let me know if we can make this an automatic process?  Can we convert each non UTF-8 record read from flat file to UTF-8 record in the program itself by any means and then update that record in the database? Is there any FM for this? Or can we convert the flat file to UTF-8 file programmatically irrespective of the original file formats?
    Any inputs on this would be greatly appreciated.
    Thanks,
    Shamim

    Sham,
    Try with the class CL_BCS_CONVERT and the method STRING_TO_SOLIX.
    Regards,
    Kiran Bobbala

  • BAPI or Conversion Program for Head Office/Branch functionality

    We are shifting our Vendors to Head Office/Branch functionality.  Our ordering vendor now becomes a Branch.  We need to transfer any open items left in the Ordering vendor account, and move them to the new Head Office account.
    Has somebody done this in their own company or client?  If yes, please advise your methodology, and if any BAPIs or conversion programs were used, please let us know.
    Thank you for your help.
    Core

    Hi
    Just Check the link below.
    http://help.sap.com/saphelp_45b/helpdata/en/5f/1faba54aee11d189740000e8322d00/frameset.htm
    Hope it helps.
    Regards
    Mohamed Mansoor

  • Conversion program to do movement type 202 and 309

    Hi everyone,
    I need to do a conversion program to upload current stock balance from 1 material to another material (Material to material transfer). This is because we have created a new material type, therefore i would need to move any current stock balance of 1 material (of a different material type) and create the material again in the new material type and transfer the current stock to it.
    Our consultant has decided upon using movement type 202 and 309 to do the goods movement required.
    Since MIGO could not be recorded, is there any other suggestion besides using ABAP program?
    Thanks in advance. Hope to get some feedback on this asap because this is urgent.

    Hi Bernard,
    You can check the direct input program RM07MMBL for goods movement.
    This is used in most of the cases to do a goods movement.
    Hope this helps
    Cheers
    VJ

  • Vendor Upload by conversion program

    HI Experts ,
    I am uploading vendor master data by conversion program , in that due to 1 field in Control data(customer - KUNNR ) I am unable to upload vendor.
    In this field when i give the customer number which is already referenced for another vendor , it gives a message that it is already referred to XXX vendor , though it is a warning message , it does not create vendor .But my session in SM30 shows success.
    But ultimate result is vendor does not get created.
    But when I give new customer or keeps blank, vendor gets created .
    please guide & advice on this problem. I need to enter data in this field .
    Thanks in advance

    HI
    thanks for your help.
    But this is happening not only in conversion program but also if i execute manually  FK01 , it does not save that vendor .
    Manual FK01 also not saving that vendor .
    What could be wrong ?
    Thanks in advance.
    Abhishek Govilkar

  • Would like to find out how a Pages document might be opened by a recipient that only has a PC with Windows and Microsoft Office.  Is there a conversion program?

    Hi!
    Would like to find out how a Pages document might be opened by a recipient that only has a PC with Windows and Microsoft Office.  Is there a conversion program?

    Making changes to PDF file: Apple Support Communities
    Have just noticed this in a thread today.   The link from Klaus1's post may allow you to use PDF and work on it.   I haven't tried it but it may give you some extra ammunition.

  • Data conversion program

    can u give idea about data conversion program for inventory management program stocks,which reads legacy extract file and the valuation master file from pc gets issue storage location valuation details and output a file with these details
    regards,
    phani

    Hi Phani,
    Make sure that the data from legacy system is stored in a TXT file in a specific format.
    In SAP, create a program to upload the file using FM GUI_UPLOAD. The structure of the internal table will be same as that of the file.
    Upload the data and update the necessary tables.
    Best regards,
    Prashant

  • Conversion program RFCONVTP not yet started ?

    Hi all,
    My requirement is to run the t-code FMZ1 , but while i am executing this transaction im getting one status messaage as " conversion program RFCONVTP not yet started". then I run that program with out test run, even though I am not able to execute the t-code FMZ1.
    please tell me how can i run the program RFCONVTP.
    Regards,

    There are a lot of SAP notes for this BAPI, and none says "don't use it", so you should be fine. You could send a message to SAP pointing them to the unreleased status.
    Thomas

Maybe you are looking for