Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error with Easter Sunday

807600Nov 4 2007 — edited Nov 4 2007
Hi, I am trying to figure out what is wrong with my easter sunday program. If someone could help I would really appreciate it. Thanks!
input java.util.Scanner

public class EasterSunday
{
  public static void main (String [] args)
  {
  system.out.print ("Enter year:");
  Scanner sc = new scanner (system.in);
  int year = sc.nextInt ();
  int a = year % 19;
  int b = year / 100;
  int c = year % 100;
  int d = b / 4;
  int e = b % 4;
  int f = ( b + 8 ) / 25;
  int g = ( b - f + 1 ) / 3;
  int h = ( 19 * a + b - d - g + 15 ) % 30;
  int i = c / 4;
  int k = c % 4 ;
  int l = (32 + 2 * e + 2 * i - h - k) % 7;
  int m = (a + 11 * h + 22 * l) / 451;
  int p = (h + l - 7 * m + 114) % 31;
  int month = ( h + l - 7 * m + 114 ) / 31;
  int day = p + 1;
  System.out.println("In"+y+"Easter Sunday falls on"+n+"of the month"+p+"\n");
  }
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 2 2007
Added on Nov 4 2007
10 comments
119 views