Repeating a method

I have a program that is a guessing game, but it only gets 1 guess and decides if its right or not, I would like to use a loop and get it to keep asking for numbers until the user gets it right heres the program
import java.util.*;
import javax.swing.JOptionPane;
public class method
     public static void main (String [ ] args)
          int number = 0;
          String numberString = null;
          int randomNumber = new Random().nextInt(100) + 1;
          get (randomNumber);
          guess (number, numberString);
          answer (number, randomNumber);
     public static int get(int randomNumber)
          return (randomNumber);
     public static int guess (int number, String numberString)
          numberString = JOptionPane.showInputDialog("Choose a number 1-100");
          number = Integer.parseInt(numberString);
          return (number);
     public static void answer (int number, int randomNumber)
          if (number == randomNumber)
               System.out.println("You Win! The random number was " + randomNumber);
          if (number > randomNumber)
               System.out.println("Too High, guess again);
          if (number < randomnumber)
               System.out.println("Too Low, guess again);
          System.exit(0);
}

okay i fixed the code a little bit but im getting an error saying unreachable statement
if (number == randomNumber){
//and
missing return statement
//for one of the last lines of code
here is the code
import java.util.*;
import javax.swing.JOptionPane;
public class method
     public static void main (String [ ] args)
          int number = 0;
          String numberString = null;
          int randomNumber = new Random().nextInt(100) + 1;
          boolean correctanswer = false;
          get (randomNumber);
          guess (number, numberString, randomNumber, correctanswer);
     public static int get(int randomNumber)
          return (randomNumber);
     public static int guess (int number, String numberString, int randomNumber, boolean correctanswer)
          correctanswer = false;
          while(!correctanswer)
               numberString = JOptionPane.showInputDialog("Choose a number 1-100");
               number = Integer.parseInt(numberString);
               return (number);
               if (number == randomNumber){
                    correctanswer = true;
                    System.out.println("You Win! The random number was " + randomNumber);
               if (number > randomNumber)
                    System.out.println("Too High, guess again");
               if (number < randomNumber)
                    System.out.println("Too Low, guess again");
          System.exit(0);
}//thanks

Similar Messages

  • Field accessed repeatedly in method

    Hello,
    I did code inspection (search for inconsistencies and errors) for my program with Intellij IDEA, and among suspicious code fragments there was shown a number of "Performance issues" results like that -
    Problem synopsis: Field foo accessed repeatedly in method bar at line 973.
    Here is a typical example of problem code:
    private static int vflag_storage_02[] = new int[VFLAG_NUM_STORAGE_AREAS];
    private static int get_V() {
            return 0x80 &
                    ~(vflag_storage_02[0] ^ vflag_storage_02[1]) &
                    (vflag_storage_02[0] ^ vflag_storage_02[2]);
        }Static method operates on static field. I don't see why I should declare a local variable to operate on like
    private static int get_V() {
            int[] localVariable = vflag_storage_02;
            return 0x80 &
                    ~(localVariable[0] ^ localVariable[1]) &
                    (localVariable[0] ^ localVariable[2]);
        }Do I get performance gain when operate on method-local variable instead of class field? Especially in case of static fileds and methods??

    I wouldn't worry about it.
    /Kaj

  • How to add the double headings in Alv Report.

    Hi All,
    Plz suggest me how to add the double headings in ALv Report.
    Ram

    Hi,
    Try out this program....
    REPORT  ypm_historycard_rep.
    TYPE-POOLS : slis.
    DATA : it_cbm TYPE STANDARD TABLE OF mara.
    DATA : it_layout TYPE STANDARD TABLE OF slis_layout_alv WITH HEADER LINE,
           wa_fcat TYPE slis_fieldcat_alv,
           it_fcat TYPE slis_t_fieldcat_alv.
    START-OF-SELECTION.
      SELECT  *
      FROM  mara
      INTO CORRESPONDING FIELDS OF TABLE  it_cbm
      where matnr = 'D80K7'.
    END-OF-SELECTION.
      it_layout-zebra = 'X'.
      it_layout-colwidth_optimize = 'X'.
      it_layout-f2code = '&ETA'.
      APPEND it_layout.
      DEFINE macro4fcat.
        wa_fcat-col_pos = &1.
        wa_fcat-fieldname = &2.
        wa_fcat-tabname = &3.
        wa_fcat-seltext_l = &4.
        append wa_fcat to it_fcat.
        clear wa_fcat.
      END-OF-DEFINITION.
      macro4fcat    '1'  'MATNR'         'IT_CBM'   'MATERIAL NO'    .
      DESCRIBE TABLE it_cbm.
      IF sy-ucomm = '&F03'.
        MESSAGE 'hi hello good morning "press enter button" this is quiz' TYPE 'S'.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
      i_callback_program                = sy-repid
    i_callback_html_top_of_page       = 'HTML_TOP_OF_PAGE'
      is_layout                         = it_layout
      it_fieldcat                       = it_fcat
       i_save                            = 'A'
      TABLES
      t_outtab                          = it_cbm
      EXCEPTIONS
      program_error                     = 1
      OTHERS                            = 2
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *&      Form  html_top_of_page
    *       text
    *      -->TOP        text
    FORM html_top_of_page USING top TYPE REF TO cl_dd_document.
      DATA: l_text(255) TYPE c.
      DATA: text1(255)  TYPE c.
      DATA: t_header TYPE REF TO cl_dd_table_element ,
            wa_header TYPE REF TO cl_dd_table_area.
      CALL METHOD top->add_gap
        EXPORTING
          width = 10.
      CALL METHOD top->add_text
      EXPORTING
        text          = 'hello'
        sap_style     = 'HEADING'
    CALL METHOD top->add_gap
        EXPORTING
          width = 20.
      CALL METHOD top->add_text
      EXPORTING
        text          = 'HOW ARE YOU'
        sap_style     = 'HEADING'.
        CALL METHOD TOP->new_line
    *      EXPORTING
    *        repeat =
        CALL METHOD top->add_gap
        EXPORTING
          width = 50.
      CALL METHOD top->add_text
      EXPORTING
        text          = '____________________________________________________________'
        sap_style     = 'HEADING'.
        CALL METHOD TOP->new_line
    *      EXPORTING
    *        repeat =
        CALL METHOD top->add_gap
        EXPORTING
          width = 90.
      CALL METHOD top->add_text
      EXPORTING
        text          = 'YOU CAN TRY LIKE THIS'
        sap_style     = 'HEADING'.
    ENDFORM.                    "html_top_of_page
    Regards
    Debarshi

  • How to print our several Billing documents in one spool request?

    Hello all,
    I encountered a problem while printing billing document.
    Currently, we only can use VF02 to change billing document's condition type and print out Billing document. It's troublesome and waste a lot of time to change output condition type in each Billing document.
    Is there a function that will list all the billing document, so we can print the selected billing document by pick this billing documents and send to printer.
    If my description is confusing, Please let me know.

    Hi, Iimnava,
    Thanks for ur reply. But there is still some problem about this.
    Let me introduce the special setting for our company's system:
    There are 2 output condition set in SAP.
    1. First one-ZD00, it will process automatically and send to a archive software. but won't print out. all of our billing document are using this output condition.
    2. Second one-ZD01, manual print out. If we need to print out the billing document, we can go to header--output, select this output condition in the dropdown list, then set sent to Local printer. save and quit. the billing document will be printed out.
    I had tried Txn VF31 and SE38.
    1. If use repeat processing method, only pull out the billing documents with ZD01 output.
    2. If use initial processing method, only pull out the billing document with output condition-ZD00 which hasn't been sent to the archive software yet.
    So I still can't reprint the billing document with Output condition-ZD00 which has been already sent to archive software.
    Sorry for the complex situation, but it's very important that we need to reprint these billing document. hope u can help me to solve this problem....

  • How do I clean-up iPhoto library in iMovie '08 and make my new ones appear?

    I'm a graphic designer and I use Adobe Bridge to add metadata (keywords) to my pictures so they're searchable on the Internet - not just iPhoto (and iLife?) and after transferring all the image files from iPhoto onto my Time Capsule (external hard-drive) and deleting the Photo Albums from iPhoto, I created a new Album to import still frames/images to use in my new iMovie project. I cleaned out (emptied) my iPhoto trash to help free-up space on my hard-drive, too.
    The problem I'm having is that my iPhoto library as viewed from iMovie - still shows all the old photo albums that I've already deleted and the new .PNG I imported doesn't appear; however, the old .JPG files I once had still appear with exclamation marks as the thumbnail images and I can't select or delete them. When I right-click on the iPhoto photo albums library within iMovie, I only get the option to open in iPhoto. I imagine there is some back door manipulation required to fix this. The iMovie and iPhoto software came pre-installed in my computer and I'm not so sure that re-formatting my computer with the start-up disc is the safe or correct answer.
    I've been researching the iMovie forum to see if there is a file I should be able to access to fix a Cache file somewhere; however, I couldn't find any .xml files, cache files, or anything anywhere yet. Thanks in advance to anyone willing and able to share some knowledge. I look forward to resolving this troubling experience. My final goal is to use the .PNG file (which contains transparent data, unlike .JPG files which fill transparent data with white pixels) as a frame image if not as a floating graphic (i.e. picture-in-picture).

    Sean in the iMovie technical support area (thanks to my lovely Apple Care plan purchase) answered my question about how to delete the iPhoto library, which I no longer use (because I use Adobe Bridge and Photoshop CS3 to browse my photos and update their Metadata to make the images searchable not only on my computer, but others who don't have iPhoto, or iLife as well; even PC users and Internet search engines - when the images are uploaded as-is - without compression and changes that occur when uploaded to image hosts such as Photobucket.com, etc.):
    Go to: *Finder >* (click on) *Pictures >* (and on the right, see iPhoto Library, Aperture, etc.? Select those files and...) *Move to Trash*
    Now when you look at the Photos Browser in iMovie (⌘2) the folder, files, blank thumbnails and junk are (thankfully) gone!
    As for using images located elsewhere for use in iMovie - I just have to locate them via the Finder, then select the file, then drag-and-drop the image for immediate placement into the part of My Project where I want to use the image and repeat this method for each incidence I want the graphic to appear.
    Unfortunately, I must upgrade to iMovie '09 if I want to be able to take advantage of the Picture-in-Picture feature, which would enable me to place a logo or image graphic in a video project while other parts of the production are playing, but I can still use the title feature to embed text information such as a business name and phone number or (website) URL pertaining to the project as a surrogate stamp, watermark, or creative signature, but no other graphic image files may be used here.

  • Check on the Remote Object

    Hi All,
    We have a situation where we have multiple RMI Servers for a particular setup. To reduce the response time what we are doing is, everytime we look up for a server for first time we store the referece then onward any call to the same server will not be through look up but through this cached reference.
    The problem is if a referece is cached then if before the second call comes on the same server there is a possibility that the server might have been restarted. Now if i invoke a method on this cached ref then i will get exception. How can i handle this case ?. I want to check whether the reference is still valid, if yes, then invoke the method otherwise lookup and then invoke.
    Any idea ?
    Sachin

    i cann't even do that cause of following.
    <code>
    try
    LookupServer() // This will either look up or if exists in the cache return that otherwise lookup & return
    Remote call /// This could fail
    Extra logic
    catch(Exception e)
    Exception thrown
    go back and lookup and fire the method
    </code>
    or
    <code>
    try
    LookupServer() // This will either look up or if exists in the cache return that otherwise lookup & return
    Remote call /// This could fail
    catch(Exception e)
    Exception thrown
    go back and lookup and fire the method
    Extra logic
    </code>
    Second option is preferable but the problem is that the same has to be repeated @ every method call. Rather i would like to have the logic in method LookupServer() only so it will be taken care once and for all methods.

  • Dynamic Website

    Hi Guys,
    I have created my dynamic website and it works alright, but I need assistant with orginization of my files.
    I have putting together an on-line store for products such as jeans.  My SQL data based is designed as follow:   categories (denim, non denim) body ( boot cut, flare, skinny and etc), style ( style number, description and 4 photos for each style)  These photos are listed in PHP with a  specific number assigned to them like st001.jpg . In Dreamweaver I linked image folder to the area where the photos are to be repeated all the way down the page for each style
    I will have over 500 SKU ( style Number) each SKU will have 4 photos. How would I be able to organize all these photos in folders?
    I found the reapeating region easy andI am planning to use my data base and use the repeat region method to list all the style number.  Do I put 2000 puts in a Image folder, or do I create a main image folder and add sub-folder for each body such as skinny, boot cut, flare and etc.  I also need to fiter these styles based on wash, rise, body and etc. if that make sense.
    Please help me with the correct  and easy method to do this task.
    I also would like the shopper to be able to magnify on the photo.  I am using the "thickbox widget" for my gallery. Please tell me if this is the correct way or suggest if there is better method.
    Thank you so much and everyone have a happy holiday.

    bobbak2011 wrote:
    Well I need a specific look for my website for high end designer clothing. Most shopping bag software I came a cross were really basic.  If there are shopping bags that have good datbase features available i would like to link them in dreamweaver to my website.
    Of course, i would not put all the photos and for each style on one page.  They will be displayed in different pages with filtering capabilities built in to the each page.
    Look should be the least of the concerns.  Most pre-built apps can be skinned to match your site.
    I am attaching an image to this post to describe details below.  It is of a wireframe of your database structure (images are easier to talk with then text in many cases).
    As you describe it you have 4 tables right now and you are trying to organize images.  The 4 tables you describe having now are:
    Products - Contains product data, pricing, and subcategory information
    Categories - Denim, etc.
    Body - Boot cut, etc.
    Style - Style number, etc.
    In the diagram you will see text in 2 colors, red and blue.  The Blue text columns are your primary keys and the Red are where foreign keys should lie.  Because there are foreign keys the tables should be setup with the InnoDB engine as opposed to the default myisam.  The foreign keys create the proper dependancies to ensure the integrity of the data so that all fields entered in are valid (this will help a lot with updating down the road).
    Next, is your images.  The table 5 is a very basic depiction of what your images table should look like.  At the very least you need to know the path, alt_tag (in case image doesn't load and to make page valid), and a foreign key on the product_id column linking to your products table.  To make things easier on your script you should have all the images in one folder.  The database will do the heavy lifting to sort the pictures to the proper items.  And because you have multiple images for each product you have an "Order_By" column to that table as well to ensure that they are printed in the proper order.
    Lastly is the query.  Your query should have the LIMIT and utilize the "offset" to select the specific rows within that range.  More info on the offset can be found here ( http://dev.mysql.com/doc/refman/5.0/en/select.html ).  The page listing query will select the first image for each product and basic information.  Then run a loop to print X number of items to the screen.  Then for your product detail page gather all the data from the multiple tables and you should be good to go.
    That should get you started.  If you have any questions post back.

  • Location of Coverflow images

    I am searching for the folder/location of the preview images used by coverflow. Where are these stored?
    thank you,
    todd

    Hi V.K.
    Ok here is what happened. I had a corrupted Numbers file that would not open. So I started doing some tinkering and found a folder that had some files associated with the corrupt file. Inside there was an image file of the spreadsheet just like the image used by Coverflow to show the preview of the file. I was able to open that image, take a screenshot and read it well enough to get the data from the spreadsheet that I needed.
    Problem is I forget now how I found this folder in the event I want to repeat this method again.
    Any idea where that was located?
    thanks
    todd

  • Can Bridge label images in Finder?

    I want the images I've selected in Bridge  - sorted by Rating -  to have a color label when I view them in a folder in Finder. Currently I just manually label each one in Finder with the Bridge window open. is there a better way?

    Label colors are very seldom interacting with other applications, Finder is not compatible with Bridge and v.v.
    If you do want to color label the files in Finder the quickest way in my opinion would be to create separate folders for this temporarily job. For instance create 5 folders, 1 folder per rating. Set those folders in the favorite panel and be sure to have them in sight.
    Use the folder panel preferable under the favorite panel, you can move panels with drag and drop to create your own workspace in Bridge.
    In the folder panel select the folder you have the rated files in. Then use the filter panel (again placed visible, move to desired place, you can have all three in one column e.g. at the left, next to content panel) and select 1 star to only view the 1 star rating in content panel.
    Now select all in content panel and drag and drop the files to the 1 star rating folder in favorites.
    Then switch to Finder and point to the 1 star rating folder. Again use select all and with right mouse click menu select the color label you want to apply, let go and all selected files are applied with the color label.
    Go back to Bridge and select the 1 star folder in favorites, drag and drop the files back to their original folder and repeat this method for other ratings using filter panel and drag and drop.
    It is a bit of a D-tour but much faster then using the one by one method…

  • EASY Question - But Hard for the Actioscript inept

    Ok,
    So this is my first attempt at making a web page...
    I am trying to simply make my little button display my movie
    labeled "Content", I don't think I am doing somthing right...
    Doh....
    I have diffrent movies (p1 & p2) for button rollover
    effects... and I have a seperate clip named content with labels for
    "start1" and "start2" that I want to display when I click the
    buttons
    Anywho if you would like to take a look see I would be very
    thankful:
    http://www.itamidesign.com/test.fla
    Thanks for your help...
    -Todd

    Something went wrong when I tried your link.
    Is your movie inside your flash program or is it an external
    movie?
    If you have named your button something like myBtn, then you
    can put in some actionscript to load an external movie such as:
    myBtn.onRelease = function():Void
    movieHolder.loadMovie("content");
    where movieHolder is the name of an empty movie clip that you
    place on the stage to hold external movies.
    Alternately, you can add the code to the button itself. In
    this case you don't need to give the button an instance name:
    on (release)
    movieHolder.loadMovie("content");
    If your movie is already part of your Flash program, instead
    of an external file, then you will need to go into the linkage
    properties of the movie and check: "Export for ActionScript". You
    do this by right clicking on the movie in the library. You must
    give the movie a name when you do this. You can still call it
    "Content". Next you use one of the formats listed above except
    change loadMovie to attachMovie. (Actually they might both still
    work, but I have been in the habit of using loadMovie for external
    content and attachMovie for internal content. Don't ask me why, I
    just try things and when they work, I tend to repeat that method of
    doing things.)
    For attachMovie, you will need to give your clip a level
    number. You can hard code in a number if you want any movie you
    attach to replace the prior movie or you can use:
    movieHolder.getNextHighestDepth() if you want your movie to be
    placed on top of anything else that you already have in the movie
    holder without replacing it.
    You can type loadMovie or attachMovie in the search bar of
    the built in help menu to see more examples. If you have further
    questions such as how to make the movie holder, be sure to ask a
    follow up question.

  • Problem during runtime....

    hi.. can someone help me with a simple program i am creating... Its a program for getting 6 lucky random numbers... everytime i try and run the program, it is able to run, but when i click the button to start to get the random numbers, a problem comes up in the background command line window. However, if i disable the method numberGone( ) method, which checks to make sure no numbers picked are repeated, everything works fine...
    i really can't figure out what is wrong... so hope someone can help me download the 2 source files and test it out for me... here are the 2 sourcefiles...
    http://www.aqcy/net/hwz/QuickPick.java (events and logic is handled here)
    http://www.aqcy.net/hwz/TotoQuickPick.java (this is the the GUI and main program)

    ok, i try my best to describe the error here...
    i suspect that the code which caused the error is the numberGone method used to check for repeating numbers being genetrated.
    boolean numberGone(int num, JTextField[] pastNums, int count) {
    for (int i = 0; i < 6; i++) {
    if (Integer.parseInt(pastNums.getText()) == num)
    return true;
    return false;
    the above code checks if the number has been repeated or not if it has been repeated, true will be returned and the do-while loop will be called again until false is returned.
    the do-while loop is below...
    void startPicking() {
         for (int i = 0; i < 6; i++) {
              int ball;
              do {
                   ball = (int) Math.floor(Math.random() * 45 + 1);
              } while (numberGone(ball, tt.numbers, i));
              tt.numbers[i].setText("" + ball);
    so, whenever i try to the program, once i click the button to start random picking the numbers, this error will appear: http://www.aqcy.net/error.jpg
    once i disable the do-while loop and checking for repeat numbers method, the error is gone...

  • Can someone review my code please

    I wrote a program for converting miles to kilometers and kilometers to miles. I've got it working good now, but there's something I can't figure out. The way I have it now, after you convert something, if you choose not to make another conversion, it exits the program. I'd like to make it go back to the main menu rather than exiting. In other words; if I convert miles to kilometers and then decide I want to do a kilometers to miles conversion, I'd like a way to return to the main menu without exiting the program. I would really appreciate any suggestions. Also, please feel free to give me pointers on better ways to make my code in general. Go easy though, I know I'm a newb. I didn't get any help making this, so please be kind. I apologize if it's hard to read; I wrote it in Jgrasp and it formated it weird when I opened it with wordpad.
    Thanks
    Here's the code:
    import java.util.*;
    public class Squires1
    Scanner keyboard = new Scanner(System.in);
         //Allows for keyboard inputs
         public void milesToKilometers()//Method for converting miles to kilometers
              double kilometers;
              String more;//Used in option for additional conversions
              final double OFFSET = 0.62136994949495;//number for conversion
              do
                   System.out.print( "Please tell me the number of miles: ");
              //Prompts user for miles
                   double miles = keyboard.nextDouble();
                   kilometers = (miles / OFFSET);
                   //calculates number of kilometers
                   System.out.println(miles + " miles is equal to " + kilometers + " kilometers.");
                   System.out.println("Would you like to make another conversion?");
                   System.out.println("Yes or No");
                   more = keyboard.next();
                        if
                        (more.equalsIgnoreCase("Yes"))
                             System.out.println("One Moment Please");
                        else
                             System.out.println("Thanks for using my program.");
                             System.out.println("Please tell your friends.");
                             System.exit(0);//Exits program if additional conversions are not desired
                   }while (more.equalsIgnoreCase("Yes"));//Repeats method if yes is typed
         public void kilometersToMiles()//Method for converting kilometers to miles
              double miles;
              String more;//Used in option for additional conversions
              final double OFFSET = 0.62136994949495;//number for conversion
              do
                   System.out.print( "Please tell me the number of kilometers: ");
              double kilometers = keyboard.nextDouble();
                   miles = (kilometers * OFFSET);//Converts kilometers to miles
                   System.out.println(kilometers + " kilometers is equal to " + miles + " miles.");
                   System.out.println("Would you like to make another conversion?");
                   System.out.println("Yes or No");
                   more = keyboard.next();
                   if
                   (more.equalsIgnoreCase("Yes"))
                        System.out.println("One Moment Please");
                   else
                        System.out.println("Thanks for using my program.");
                        System.out.println("Please tell your friends.");
                        System.exit(0);//exits program if user types "no"
                   }while (more.equalsIgnoreCase("Yes"));//Repeats loop if user types "yes"
              public static void main(String[] args)//main method
                   Squires1 s1 = new Squires1();//creates new instance of class      
                   int option;
                   Scanner keyboard = new Scanner(System.in);//allows for keyboard inputs
         System.out.println( "I can convert distances for you. Please tell me what you'd like to do.");
         System.out.println( "1. Convert miles to kilometers ");
                   System.out.println( "2. Convert kilometers to miles ");
                   System.out.println( "3. End our session. ");
         option = keyboard.nextInt();
              if (option == 1)
                   s1.milesToKilometers();//runs milesToKilometers method
                        if (option == 2)
                        s1.kilometersToMiles();//runs kilometersToMiles method                }
                        if (option == 3)
                             System.out.println("Thanks for using my program.");
                             System.out.println("Have a nice day.");
                   }while (option != 3);//Repeats main method as long as user doesn't type 3
    }

    Here's another instance of my code with tags.
    import java.util.*;
    public class Squires1
    Scanner keyboard = new Scanner(System.in);
    //Allows for keyboard inputs
    public void milesToKilometers()//Method for converting miles to kilometers
    double kilometers;
    String more;//Used in option for additional conversions
    final double OFFSET = 0.62136994949495;//number for conversion
    do
    System.out.print( "Please tell me the number of miles: ");
    //Prompts user for miles
    double miles = keyboard.nextDouble();
    kilometers = (miles / OFFSET);
    //calculates number of kilometers
    System.out.println(miles + " miles is equal to " + kilometers + " kilometers.");
    System.out.println("Would you like to make another conversion?");
    System.out.println("Yes or No");
    more = keyboard.next();
    if
    (more.equalsIgnoreCase("Yes"))
    System.out.println("One Moment Please");
    else
    System.out.println("Thanks for using my program.");
    System.out.println("Please tell your friends.");
    System.exit(0);//Exits program if additional conversions are not desired
    }while (more.equalsIgnoreCase("Yes"));//Repeats method if yes is typed
    public void kilometersToMiles()//Method for converting kilometers to miles
    double miles;
    String more;//Used in option for additional conversions
    final double OFFSET = 0.62136994949495;//number for conversion
    do
    System.out.print( "Please tell me the number of kilometers: ");
    double kilometers = keyboard.nextDouble();
    miles = (kilometers * OFFSET);//Converts kilometers to miles
    System.out.println(kilometers + " kilometers is equal to " + miles + " miles.");
    System.out.println("Would you like to make another conversion?");
    System.out.println("Yes or No");
    more = keyboard.next();
    if
    (more.equalsIgnoreCase("Yes"))
    System.out.println("One Moment Please");
    else
    System.out.println("Thanks for using my program.");
    System.out.println("Please tell your friends.");
    System.exit(0);//exits program if user types "no"
    }while (more.equalsIgnoreCase("Yes"));//Repeats loop if user types "yes"
    public static void main(String[] args)//main method
    Squires1 s1 = new Squires1();//creates new instance of class
    int option;
    Scanner keyboard = new Scanner(System.in);//allows for keyboard inputs
    System.out.println( "I can convert distances for you. Please tell me what you'd like to do.");
    System.out.println( "1. Convert miles to kilometers ");
    System.out.println( "2. Convert kilometers to miles ");
    System.out.println( "3. End our session. ");
    option = keyboard.nextInt();
    if (option == 1)
    s1.milesToKilometers();//runs milesToKilometers method
    if (option == 2)
    s1.kilometersToMiles();//runs kilometersToMiles method }
    if (option == 3)
    System.out.println("Thanks for using my program.");
    System.out.println("Have a nice day.");
    }while (option != 3);//Repeats main method as long as user doesn't type 3
    }

  • Imovie file size too large

    Created 22 min. film clip (from dvd camcorder tape.) in imovies and sent to iDVD, States file too large and need to delete some of it. Looked at project & file size, states it's 14,000 minutes long or 42GB. Have I duplicated something or what. Have been unable to get handle on this to complete project.
    Have thought I might have to go back and delete bunch of clips to try resending...but want to understand whats going on. help appreciated.
    iMac   Mac OS X (10.4.8)   20" iMac 2.16Ghz intel core 2 duo, MacOS 10.4

    Hello,
    I'm pretty new to using a camcorder and importing the footage it into iMovie and iDVD. I was wondering this: does it seem normal that a four minute video in iMovie would = 836MB? I knew video took up a lot of memory but I didn't think it was quite that large. I took the video with my Sony HandyCam MiniDV (model HC-48). It was recorded in the 16:9 format, SP mode.
    Second question, I agreed to record a wedding for a friend and she would like me to take quite a lot of footage. I'm thiking I could end up having 6 hours of video on MiniDV tapes by the time I'm done (before editing). I have a limited amount of HD space left on my iMac G5 (aprox. 36GB), would you recommend importing the video in smaller sections, editing it, burning it to DVD (as a themed movie) and then repeating that method? Or would it be a much better idea to get a 250GB external hard drive and set it up to be able to give me the extra 'head room' I need for the editing and finishing process? Do you have any good recommendations for an external (FireWire) hard drive brand that works well with Macs, but is also affordable (I'm not really hoping to drop a lot more money into this project)?
    Sorry to throw so many questions at you in one post. This project has mushroomed WAY beyond what I first thought it was going to be so I'm trying to get ready for this in a hurry (wedding is two weeks away).
    Thank you for any insights you can offer.

  • Is how UIInput handles local values a large framework bug?

    UIInput in both 1.1 and 1.2 stores the local value in a member variable. This seems like a large bug to me. JSF seems to be designed after more of a flyweight pattern.
    Take for example UIData. For each row in the data model, the componets are re-rendered. This means that each component represents as many values as there are rows. Therefore, only one value per component makes UIData bugged.
    This bug is evident when submitting a UICommand as immediate on a page with a dataTable. All the UIInput componets lose their values when the page is re-rendered.
    How this could work:
    Instead of a local Object to hold the value, the member value should be a Map<String, Object>. The key of this Map would be the client ID of the component. The value, would obviously be the component's local value (submitted value).
    The "corrected" code could look like:
    private Map<String, Boolean> valid = new HashMap<String, Boolean>();
    private Map<String, Object> localValues = new HashMap<String, Object>();
    public boolean isValid() {
    return valid.get(this.getClientId(FacesContext.getInstance()));
    public void isValid(boolean valid) {
    return valid.put(this.getClientId(FacesContext.getInstance()), valid);
    ... (repeat similar methods for the local value and if the local value is set)...If all components were built this way, then tree, table and other 'complex' controls would finally behave "correctly".
    Without this, I can't see how UIData will ever be fully usable with validators and using the immediate flag.

    you may try these:
    1. Add one more logic (define as boolean variable), then OR this variable with the original Boolean switch you used in subvi, then main vi can change the new added variable which is defined as local or global variable.
    2. Change the subvi while loop as state machine, or use other Synchronization techniques like notifier

  • ITunes won't start & messes with computer.

    Whenever I click the shortcut to run iTunes, the program never actually shows up. Looking in the Task Manager shows that the process is running, but the program itself is not accessible. I am also unable to end the process. It just doesn't respond. It also displays NO error message.
    Whenever I try to run it, not only does it not open like described, other programs follow in its wake and fail to open but they all register their processes as having started.
    I've tried, repeatedly, the method I've seen that involves uninstalling QuickTime and iTunes and then reinstalling them separate but to no avail.
    Any ideas?
    I've had this problem before but the only way I fixed it was with a reformat. I need iTunes for my iPod and CD management...
    Thanks for any help!

    I can't take credit for this and don't remember who to give it to, but it was right here under another topic and it worked for me and was very simple.... so simple I could do it!
    I have McAfee and don't know if it will work with any other antivirus program, but give it a try.... it's better than calling tech support, right?
    I went and deleted the song that had the error message next to it under download in the activity area on the left on the itunes page or in the itunes folder in "my music" in "my documents". (I read to do this somewhere around here)
    Then go to the start menu then to "run", type in <services.msc> (without the ) and click on "ok", scroll down to "McAfee redirector" in that window, then right click on it and then click "stop". I kept that window minimized so I just clicked "start" on the left in that window when I was done getting the song to my library. Be sure to write this all down so it isn't forgotten in case it happens again.
    Now open itunes and sign in. Go to "store" on the very top of the page and then click on "check for purchases". it should have the song or whatever you bought that never made it to your library.
    Who ever figured this out, thanks a lot! Thanks to you I only had a few minutes of frustration.... I hope it works for you and the others having this problem.

Maybe you are looking for

  • NullPointerException while running the page from jdeveloper

    Hi , I am getting following Exception while Running the OAF page in Jdeveloper after downloading from the server which is working correctly (in the instance). Can you please help to resolve this exception. Error Page Exception Details. oracle.apps.fn

  • Smart Recorder not working anym

    I don't know what happened but Smart Recorder seems to have stopped working. It doesn't pick up on the input source. I have the Peak Meter box checked and there is no activity on there. I've tried different input sources. Wave and What U Hear but non

  • Error while calling hr_psbuffer_initialize

    Hi, I have a scenario where, I need to call FM RH_PM_GET_TIMECONSTRAINT, followed by some code which calls to FM HR_PSBUFFER_INITIALIZE. For Some Infotypes like PA0014 where TimeConstraint need to be read from T582A, the FM RH_PM_GET_TIMECONSTRAINT s

  • Message sending options

    I have Blackberry Q5 phone. The issue I am facing is, when send a text message to one of contacts it goes as MMS and as a Text message. And the issue is with only one contact, for rest there is no issues. Please help.

  • Album v2.0 upgrade

    I have v2.0 running OK under Windows 7. Lately I've experienced problems with image files created by a Fujifilm Finepix F550EXR camera. Sometimes the import process falls over and has to be repeated to complete the import of eg 100 files. On one occa