Results 1 to 3 of 3
  1. #1
    Southpaw is offline Member
    Join Date
    Dec 2012
    Posts
    24
    Rep Power
    0

    Default Leap Year program

    My instuctor said you are sending me back void from the fib() in LeapYear.java and i dont understand what he means.
    This is my code:
    import javax.swing.JOptionPane;



    public class LeapYearJDialog
    {
    public static void main(String[] args)
    {

    String y1;
    int year;

    LeapYear box = new LeapYear();

    y1 =
    JOptionPane.showInputDialog("Input a Year.");
    year = Integer.parseInt(y1);

    System.out.println(box.setFib(year));

    System.exit(0);
    }
    }
    --------------------------------------------------------
    import javax.swing.JOptionPane;


    public class LeapYear
    {
    public boolean setFib(int year)
    {
    if((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0)))
    return true;
    else
    return false;

    }

    }


    I'm very confused at this point. This program does work so i don't understand what he means by the void. Maybe the return type? but if thats the case what do i need to use?

  2. #2
    Southpaw is offline Member
    Join Date
    Dec 2012
    Posts
    24
    Rep Power
    0

    Default Re: Leap Year program

    also i need to add that im not supposed to change anything in the leapyear.java b/c he told me it is correct.

  3. #3
    Southpaw is offline Member
    Join Date
    Dec 2012
    Posts
    24
    Rep Power
    0

    Default Re: Leap Year program

    I just double checked what I sent my professor and it seems I sent the wrong file. Im just waiting for a response from him. Sorry guys.

Similar Threads

  1. Having a problem with a leap year program.
    By Southpaw in forum New To Java
    Replies: 10
    Last Post: 12-05-2012, 03:19 AM
  2. Help with Leap Year program
    By newtojavahelp in forum New To Java
    Replies: 18
    Last Post: 12-04-2012, 07:13 PM
  3. Leap Year Test: Help!
    By Zigster in forum New To Java
    Replies: 5
    Last Post: 04-23-2012, 05:02 AM
  4. Leap Year Calculator
    By Pkaay in forum New To Java
    Replies: 9
    Last Post: 10-12-2010, 10:47 PM
  5. Leap Year Program
    By busdude in forum New To Java
    Replies: 3
    Last Post: 10-16-2008, 03:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •