File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Java quarterly calculation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java quarterly calculation" Watch "Java quarterly calculation" New topic

Java quarterly calculation

Sherin Branch

Joined: May 15, 2007
Posts: 2
What algorithm would you use to compute quartely totals.

Quarters(1Oct - 31 Dec. ;1 Jan - 31Mar; 1 Apr - 30 Jun.)

For example: compute the days idle in the first quarter(1Oct - 31Dec.)

The user will only enter month and year.

marc weber

Joined: Aug 31, 2004
Posts: 11343

Welcome to JavaRanch!

I'm sorry I don't understand your question. The user enters a month and year, and then...?

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Please post your question in just one forum at a time. I've deleted the duplicates in other forums. Thanks.

"I'm not back." - Bill Harding, Twister
marc weber

Joined: Aug 31, 2004
Posts: 11343

In one of your duplicate threads, you offered a little more information...
...I will check to see what quarter the entered month and year falls into. If the month and year falls in the first quarter(1 Oct-31 Dec.) pull all the idle days values out of the database for that quarter...

But what is your question? I don't know whether you're asking how to tell which quarter a date falls into, or whether you're asking about database connectivity.
Sidd Kulk
Ranch Hand

Joined: Feb 20, 2007
Posts: 152
It would be helpful in solving a problem if you could come up with a rough solution, and then narrow down your doubts to a particular module. Just a suggestion.

Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Start as small as you can manage. Isolate this little part of your program into a new class called Quarter - maybe temporarily, maybe forever. Can you make this work? Put it in the main() of a throw-away test class. Let's give it a month (0-11 like Date) and ask what quarter it's in (0-3)

Show us what you make for that!

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: Java quarterly calculation
jQuery in Action, 3rd edition