JAVA Programming Help

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

  1. BloodWolfJW
    OP

    BloodWolfJW Marotheit

    Member
    220
    5
    Feb 11, 2011
    United States
    Colorado Springs
    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

    naglaro00 Mildly disturbed

    Member
    1,381
    10
    Jun 5, 2009
    Pulse
    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

    purplesludge anyone have any ideas for this space

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

    BloodWolfJW Marotheit

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

    BloodWolfJW Marotheit

    Member
    220
    5
    Feb 11, 2011
    United States
    Colorado Springs
    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

    BloodWolfJW Marotheit

    Member
    220
    5
    Feb 11, 2011
    United States
    Colorado Springs
    Forgot to mention I have absolutely no errors as of right now.