What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » General » General Chit Chat » Java programming help needed

Java programming help needed
Author: Message:
Vilkku
Veteran Member
*****

Avatar

Posts: 1411
Reputation: 27
35 / Male / Flag
Joined: Mar 2003
O.P. Java programming help needed
Okey, I got this exersice. We are supposed to make a program that asks the user for a year and the program will tell if it is one of those years with an extra day (forgot what it's called). We are supposed to do it with boolea, and theese are the requirements for the year:

code:
(DivideableWith4 && !DivideableWith100) || DivideableWith400

Now, how can I easily get the program to check if it is possible to divide a number with those?
[Image: signature.php]
03-30-2005 05:02 PM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Java programming help needed
quote:
Originally posted by Vilkku
We are supposed to make a program that asks the user for a year and the program will tell if it is one of those years with an extra day (forgot what it's called)
a leapyear.

quote:
Originally posted by Vilkku
We are supposed to do it with boolea, and theese are the requirements for the year:
code:
(DivideableWith4 && !DivideableWith100) || DivideableWith400
Now, how can I easily get the program to check if it is possible to divide a number with those?
divide the number and check if there is a remainder.

This can either be done by comparing the integer division with a floating point division. eg:
   floatingpoint = 101 / 4
   integer = 101 \ 4
   If floatingpoint == integer Then IsDivideableBy4

Or by the MOD function. eg:
  If (101 MOD 4) * 4 = 101 Then IsDivideableBy4

Or maybe Java even has function which directly returns the remainder of a division (dunno). eg:
  Remainder = 101 XXX 4
  If Remainder = 0 Then IsDivideableBy4

This post was edited on 03-30-2005 at 06:39 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
03-30-2005 06:19 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On