Honestly, it was too convoluted for me to figure out why it was doing what it was doing. Right off I saw you were trying to make while() loops do for() loop work. Also that assignment of keyA[i] to...
Type: Posts; User: summit45
Honestly, it was too convoluted for me to figure out why it was doing what it was doing. Right off I saw you were trying to make while() loops do for() loop work. Also that assignment of keyA[i] to...
public double calculateaverageconsumption(int byDistance, int byConsommation) {
float calculateaverageconsumption = (float) byDistance / byConsommation;
return averageconsumption;
}
...
So you just decided to declare the class abstract even though you didn't understand what abstract classes were for?
Can I ask, why?
-summit45
Well I have run the "Build & Clean" option more than once already. Same issue. Even so, there was never a version of the code where decode() was called from the constructor anyway. Could it be a...
Yeah, it only gives me bad output when I execute it in NetBeans. I have no idea why that would be so. It works even if I execute it from the command line in the NetBeans build folder for this...
SSCCE version (still requires -d command line arg just in case that's somehow part of the problem):
import java.io.IOException;
import java.io.File;
import java.io.FileWriter;
import...
I am really lost on this one.
I am creating (just for my own practice and because it's kind of cool) a program to encrypt a string according to a very basic algorithm I designed. That part works...
Yeah I got him, that's what I said, or so I thought lol. Well I didn't talk about that first if() without braces but yeah exactly, that's just it. If you put that println() inside the if(), and the...
I once wrote a simple program - that turned out to have no use, but was good practice - that simply takes microphone input and routes it right back out the speakers.
There were several oddities in...
Well if it throws that exception, that breaks out of the try {} block, and executes the catch statement. And if the number is in range, the if() {} block doesn't execute, so either way, that...
The if() {} statement is not inside a try {} block, so there is nothing to catch that exception, and the program will end.
If a number out of range is entered, the program stops running.
If a...
However, you are of course right that code ought to be commented. I decided to comment it because it is possible I will want to show it to my university or someone to show what I taught myself...
To get the percent of a number, you multiply it by the percentage value with the decimal two places to the left. So ten percent of 60 = 60 * 0.10.
So just get your input, set the var to: var +=...
Which it does, indeed. I resent the implication that I'm too stupid to look for the answer elsewhere before asking here. I am asking because I could not find it.
You say you have better things...
Quick question that my last program made me want to ask. I found another solution that didn't require me to do this for the program, but it got me curious: How do you represent a return key in a...
And I haven't asked anyone to read it. I put it up in case it was to interest of anyone searching the web or the forums looking for answers to a similar problem, or if someone had a comment they...
Believe me when I tell you that I'm pretty confident no human being besides me is ever going to have to reprogram this, and if that day comes, I will put comments in it.
-summit45
It just does what you said. Declares Calendar objects representing each target time, and parses their Epoch time through a Date object into a long var. Then establishes the current Epoch time, and...
Well, this forum just lost me my last two posts, so here goes an approximate re-do:
You were right about the CPU usage! I had no idea it would be that bad over a little loop. But yeah, I have...
How would you do it? Like I said, I know most of the code I write could be improved. That's because I'm quite new to Java and teaching it to myself. I have no idea how I would compute the time to...
Well, the program works now. Doesn't do quite everything I'd like, but it's good enough, it runs, it will get the job done I believe.
I thank everyone who replied for their help!
-summit45
...
Does start() normally finish playing the audio file it references before allowing execution to continue?
-summit45
println()'s would show me what's happening and when, but not why - and indeed as the code stands now, they already DO show that the for() loop in the FilePlayer is being called twice, one time...
I understand that. When I wrote it, I figured it was probably rather disgusting code-wise, but again, I am inexperienced, but I figure the best way to learn is to go do it, even if it isn't perfect...
EDIT: Ignore this post. I misunderstood what the OP wanted and created a solution to a problem that didn't exist. I'll take a look later and see if I can come up with something - I have a vague...