• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java quarterly calculation

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Thanks.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch!

I'm sorry I don't understand your question. The user enters a month and year, and then...?
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please post your question in just one forum at a time. I've deleted the duplicates in other forums. Thanks.
 
marc weber
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Sid
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic