Vulpes
posted
5419 posts
since
Feb 28, 2011
from
|
|
Re: Anyone who is good with JAVA help?
|
|
|
|
|
|
|
|
|
|
|
You need to use int variables here rather than double:
int userInput; int secondsInDay = 86400; int secondsInhours = 3600; int secondsInMinutes = 60;
Also, this part of the code:
double answerDay = userInput % secondsInDay; double answerHours = answerDay % secondsInhours; double answerMinutes = answerHours % secondsInMinutes; double answerSeconds = answerMinutes;
should be:
int answerDay = userInput / secondsInDay; int remainder = userInput % secondsInDay; int answerHours = remainder / secondsInhours; remainder = remainder % secondsInhours; int answerMinutes = remainder / secondsInMinutes; int answerSeconds = remainder % secondsInMinutes;
|
|
|
|
|
|
Prime b
posted
420 posts
since
Dec 12, 2011
from
|
|
Re: Anyone who is good with JAVA help?
|
|
|
|
|
|
|
|
|
|
|
yup, it worked, I was thinking about doing something like that but after awhile I switched to C sharp lol...
|
|
|
|
|
Practice makes it perfect && All science is either computer programming or stamp collecting
|
|
|
|
|
|
Vulpes
posted
5419 posts
since
Feb 28, 2011
from
|
|
Re: Anyone who is good with JAVA help?
|
|
|
|
|
|
|
|
|
|
|
I hope they're not trying to teach you two programming languages at the same time.
Programming is confusing enough when you're starting out and, even though the syntax of Java and C# is fairly similar, trying to learn them both simultaneously is not a good idea, IMO.
It's best to master one language before going on to learn another, otherwise you just end up with a big muddle in your head!
|
|
|
|
|
|
Prime b
posted
420 posts
since
Dec 12, 2011
from
|
|
Re: Anyone who is good with JAVA help?
|
|
|
|
|
|
|
|
|
|
|
Well, I am taking 4 classes, 1 is C sharp advanced, 1 is Java , 1 Visual Basic and 1 hardware software support. So I am actually taking 3 programming classes... I am doing not bad in in Java and VB because its pretty similar to C sharp, but C sharp class is giving me some problems..
|
|
|
|
|
Practice makes it perfect && All science is either computer programming or stamp collecting
|
|
|
|
|
|
Prime b
posted
420 posts
since
Dec 12, 2011
from
|
|
Re: Anyone who is good with JAVA help?
|
|
|
|
|
|
|
|
|
|
|
Btw, do you know JAVA ? So i know for future reference. And why netbeans has such lame IDE, no intellisense, takes so much more time to type out each variable , reserved words, etc..
|
|
|
|
|
Practice makes it perfect && All science is either computer programming or stamp collecting
|
|
|
|
|
|
Vulpes
posted
5419 posts
since
Feb 28, 2011
from
|
|
Re: Anyone who is good with JAVA help?
|
|
|
|
|
|
|
|
|
|
|
I have some knowledge of Java but I don't know it as well as I know the .NET languages.
However, we've been getting a lot of questions about Java recently and there's now a dedicated forum category for it.
Although I don't use it, I thought NetBeans did have intellisense support though I'd be surprised if it was as good as VS.
|
|
|
|
|
|
Sam Hobbs
posted
6490 posts
since
Sep 07, 2009
from
Los Angeles, California, USA
|
|
Re: Anyone who is good with JAVA help?
|
|
|
|
|
|
|
|
|
|
|
I have heard that Netbeans performance is not good. I know it was slow when I used it with my older system. My current system has 4 cores Netbeans is not much of a problem for me but I do not use it anyway.
Have you tried Eclipse?
|
|
|
|
|
Thinking is a feeling; pleasant for some and unpleasant for others.
|
|
|
|
|
|
Prime b
posted
420 posts
since
Dec 12, 2011
from
|
|
Re: Anyone who is good with JAVA help?
|
|
|
|
|
|
|
|
|
|
|
Hey Sam! I have heard about eclipse, but I have never used it, also my teacher said no to eclipse.
I just found out you can use ctrl+space and it will display my declared variables , reserved words that you want to use , etc. So its not so bad, before I had to type out everything out....
|
|
|
|
|
Practice makes it perfect && All science is either computer programming or stamp collecting
|
|
|
|
|
|