Click here to Skip to main content
16,004,782 members
Home / Discussions / Algorithms
   

Algorithms

 
QuestionLogic for Billing Pin
briogene21-Oct-07 21:07
briogene21-Oct-07 21:07 
AnswerRe: Logic for Billing Pin
Dan Neely22-Oct-07 2:15
Dan Neely22-Oct-07 2:15 
GeneralRe: Logic for Billing Pin
DQNOK22-Oct-07 9:20
professionalDQNOK22-Oct-07 9:20 
AnswerRe: Logic for Billing [modified] Pin
DQNOK22-Oct-07 9:00
professionalDQNOK22-Oct-07 9:00 
GeneralRe: Logic for Billing Pin
briogene26-Oct-07 22:08
briogene26-Oct-07 22:08 
GeneralRe: Thanks Pin
DQNOK29-Oct-07 10:25
professionalDQNOK29-Oct-07 10:25 
AnswerRe: Logic for Billing Pin
Duane in Japan23-Oct-07 6:08
Duane in Japan23-Oct-07 6:08 
QuestionPlease HELP! Carl Gauss Algorithm for getting Easter on specified year JAVA Pin
Mr. Deja Vu16-Oct-07 15:01
Mr. Deja Vu16-Oct-07 15:01 
So so far I'm trying to implement a class. I can do that alright but I'm having trouble with the methods. I read his algorithm something like this:

1. Let y be the year(such as 1800 or 2001).
2. Divide y by 19 and call the remainder a. Ignore the quotient.
3. Divide y by 100 to get a quotient b and a remainder c.
4. Divide b by 4 to get a quotient d and a remainder e.
5. Divide 8 * b + 13 by 25 to get a quotient g. Ignore the remainder.
6. Divide 19 * a + b - d - g + 15 by 30 to get a remainder h. Ignore the quotient.
7. Divide c by 4 to get a quotient j and a remainder k.
8. Divide a + 11 * h by 319 to get a quotient m. ignore the remainder.
9. Divide 2 * e + 2 * j - k - h + m + 32 by 7 to get remainder r. Ignore the quotient.
10. Divide h - m + r + 90 by 25 to get a quotient n. Ignore the remainder.
11. Divide h - m + r + n + 19 by 32 to get a remainder p. Ignore the quotient.

For the program I input 2001 and it gave me back n=4 and p=17
It's supposed to give back n=4 and p=15.

Here are the equations I wrote:

public int getEasterSundayMonth(int y)
{
double a = y % 19;
int b = (int) y/19;
double c = y % 100;
int d = (int) b/4;
double e = b % 4;
int g = (int) ((8 * b) + 13)/25;
double h = ((19 * a) + b - d - g + 15) % 30;
int j = (int) c/4;
double k = c % 4;
int m = (int) ((a + 11) * h)/319;
double r = ((2 * e) + (2 * j) - k - h + m + 32) % 7;
int n = (int) (h - m + r + 90)/25;
return n;
}

public int getEasterSundayDay(int y)
{
double a = y % 19;
int b = (int) y/19;
double c = y % 100;
int d = (int) b/4;
double e = b % 4;
int g = (int) ((8 * b) + 13)/25;
double h = ((19 * a) + b - d - g + 15) % 30;
int j = (int) c/4;
double k = c % 4;
int m = (int) ((a + 11) * h)/319;
double r = ((2 * e) + (2 * j) - k - h + m + 32) % 7;
int n = (int) (h - m + r + 90)/25;
int p = (int) (h - m + r + n + 19) % 32;
return p;

Please help me find out what's wrong. I kind of don't understand, I do realize that this site is filled more with C and C++, but hopefully you guys can help me out.
AnswerRe: Please HELP! Carl Gauss Algorithm for getting Easter on specified year JAVA Pin
cp987616-Oct-07 15:55
cp987616-Oct-07 15:55 
GeneralRe: Please HELP! Carl Gauss Algorithm for getting Easter on specified year JAVA Pin
Mr. Deja Vu16-Oct-07 18:15
Mr. Deja Vu16-Oct-07 18:15 
QuestionPlotting large amount of data points Pin
nico8015-Oct-07 11:26
nico8015-Oct-07 11:26 
AnswerRe: Plotting large amount of data points Pin
cp987615-Oct-07 12:38
cp987615-Oct-07 12:38 
GeneralRe: Plotting large amount of data points Pin
nico8015-Oct-07 14:32
nico8015-Oct-07 14:32 
GeneralRe: Plotting large amount of data points Pin
nico8016-Oct-07 11:25
nico8016-Oct-07 11:25 
GeneralRe: Plotting large amount of data points Pin
cp987616-Oct-07 14:52
cp987616-Oct-07 14:52 
GeneralRe: Plotting large amount of data points Pin
Ri Qen-Sin23-Oct-07 14:59
Ri Qen-Sin23-Oct-07 14:59 
GeneralA Prayer for Archimedes Pin
Bassam Abdul-Baki10-Oct-07 6:44
professionalBassam Abdul-Baki10-Oct-07 6:44 
GeneralRe: A Prayer for Archimedes Pin
IdUnknown10-Oct-07 7:16
IdUnknown10-Oct-07 7:16 
GeneralRe: A Prayer for Archimedes Pin
Bassam Abdul-Baki10-Oct-07 7:26
professionalBassam Abdul-Baki10-Oct-07 7:26 
Questionfill memory with a pattern Pin
DQNOK10-Oct-07 5:21
professionalDQNOK10-Oct-07 5:21 
AnswerRe: fill memory with a pattern Pin
DQNOK11-Oct-07 7:35
professionalDQNOK11-Oct-07 7:35 
AnswerRe: fill memory with a pattern Pin
Alan Balkany24-Oct-07 4:13
Alan Balkany24-Oct-07 4:13 
GeneralRe: fill memory with a pattern Pin
DQNOK24-Oct-07 10:33
professionalDQNOK24-Oct-07 10:33 
GeneralRe: fill memory with a pattern Pin
DQNOK25-Oct-07 3:41
professionalDQNOK25-Oct-07 3:41 
QuestionAlgorithm to check how different are two files? Pin
bosfan9-Oct-07 22:01
bosfan9-Oct-07 22:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.