1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

While Loops - Error Help pls

Discussion in 'Java' started by Zombie_GurL, Nov 9, 2011.

  1. Zombie_GurL

    Zombie_GurL New Member

    Joined:
    Nov 9, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi,
    I have been asked to write a program for one of my 1st year modules. im new to programming. Given below is the question. I have answered it partly and there are some errors and its incomplete too. it would be really great if someone could help me to complete it.

    This is the code that Iv written so far. I have no idea how to do beyond this.

    Code:
    import javax.swing.*; // import the swing library for I/O
    
    class films
    {
    public static void main (String[] param)
    {
    
    movies();
    System.exit(0);
    
    } // END main
    
    
    public static void movies()
    {
    String again = "";
    String film;
    int currentyear=2011;
    String year = "";
    String textinput1;
    int oldest year=9999;
    
    String textinput3;
    
    while (!(again.equals("QUIT")))
    {
    
    film = JOptionPane.showInputDialog("Name a film");
    
    textinput1 = JOptionPane.showInputDialog
    ("What year was" +film+ "released");
    year = Integer.parseInt(textinput1);
    
    
    again = JOptionPane.showInputDialog("Name a film");
    }
    
    System.out.println("The earliest film was");
    
    if (current year < year){ // i cant seem to sort out the rest of the if statement
    
    return;
    
    
    } // END 
    
    } // END class 
    Thanks in advance
    ZombieGurL
     
    Last edited by a moderator: Nov 9, 2011

Share This Page