JAVA Programming Help

Discussion in 'General Off-Topic Chat' started by BloodWolfJW, Oct 1, 2011.

Oct 1, 2011

JAVA Programming Help by BloodWolfJW at 4:05 AM (775 Views / 0 Likes) 5 replies

  1. BloodWolfJW
    OP

    Member BloodWolfJW Marotheit

    Joined:
    Feb 11, 2011
    Messages:
    220
    Location:
    Colorado Springs
    Country:
    United States
    So, I have a program I'm making in the process of taking my classes. I'll post my code below.

    Code:
    import java.util.Scanner;
    public class ROMBox {
    
    ÂÂÂÂpublic static void main(String[] args) {
    ÂÂÂÂÂÂÂÂScanner ROM = new Scanner (System.in);
    ÂÂÂÂÂÂÂÂfloat Region, Title, Hack, Emulator;
    ÂÂÂÂÂÂÂÂ
    ÂÂÂÂÂÂÂÂSystem.out.println ("Hello. Welcome to ROMBox. Please wait while we fetch the necessary files.");
    ÂÂÂÂÂÂÂÂ
    ÂÂÂÂÂÂÂÂtry {Thread.sleep(4000);} catch(InterruptedException e) {}
    ÂÂÂÂÂÂÂÂ
    ÂÂÂÂÂÂÂÂSystem.out.println ("");
    ÂÂÂÂÂÂÂÂSystem.out.println ("Loading...");
    ÂÂÂÂÂÂÂÂSystem.out.println ("");
    ÂÂÂÂÂÂÂÂ
    ÂÂÂÂÂÂÂÂtry {Thread.sleep(2000);} catch(InterruptedException e) {}
    ÂÂÂÂÂÂÂÂ
    ÂÂÂÂÂÂÂÂSystem.out.print ("Please Enter the Desired Region: ");
    ÂÂÂÂÂÂÂÂRegion = ROM.nextFloat();
    ÂÂÂÂÂÂÂÂ
    ÂÂÂÂÂÂÂÂSystem.out.print ("Please Enter the Desired Title: ");
    ÂÂÂÂÂÂÂÂTitle = ROM.nextFloat();
    ÂÂÂÂÂÂÂÂ
    ÂÂÂÂÂÂÂÂSystem.out.print ("Please Enter any Desired Hacks: ");
    ÂÂÂÂÂÂÂÂHack = ROM.nextFloat();
    ÂÂÂÂÂÂÂÂ
    ÂÂÂÂÂÂÂÂSystem.out.print("Do You Have an Emulator Available? ");
    ÂÂÂÂÂÂÂÂEmulator = ROM.nextFloat();
    
    ÂÂÂÂ}
    
    }
    I don't need any programming tips or anything, I just need to know what the desired variable is. Right now, it says float, which will allow for numbers. What do I need to put to make it accept words? Thanks [​IMG]
     
  2. naglaro00

    Member naglaro00 Mildly disturbed

    Joined:
    Jun 5, 2009
    Messages:
    1,381
    Location:
    Pulse
    Country:
    Philippines
    String variable = JOptionPane.showInputDialog ("Dialog here");

    float anotherVariable = float.parseFloat (variable);

    you input the words then it converts it into float

    like that?
     
  3. purplesludge

    Member purplesludge anyone have any ideas for this space

    Joined:
    Mar 2, 2009
    Messages:
    1,047
    Location:
    wv
    Country:
    United States
    ROM.next()
    I think
    Edit: It is ROM.next() however it needs to be stored in a string not a float.
     
  4. BloodWolfJW
    OP

    Member BloodWolfJW Marotheit

    Joined:
    Feb 11, 2011
    Messages:
    220
    Location:
    Colorado Springs
    Country:
    United States
    I decided to give it a GUI and add text boxes. I'll probably come back to this later. Thanks [​IMG]
     
  5. BloodWolfJW
    OP

    Member BloodWolfJW Marotheit

    Joined:
    Feb 11, 2011
    Messages:
    220
    Location:
    Colorado Springs
    Country:
    United States
    I need help again. I have the code for downloading a file from a URL, and I have JList and buttons; I need to know how to set up actionlisteners to download that file. It's easier if I just show you a picture.

    I need the top 3 selections (United States, Licensed, and 3-D WorldRunner) to run the download code when I hit "Download".

    [​IMG]

    Here's the code for the download:
    Warning: Spoilers inside!
    Here's the code for the program:
    Warning: Spoilers inside!
     
  6. BloodWolfJW
    OP

    Member BloodWolfJW Marotheit

    Joined:
    Feb 11, 2011
    Messages:
    220
    Location:
    Colorado Springs
    Country:
    United States
    Forgot to mention I have absolutely no errors as of right now.
     

Share This Page