stultuske 1,116 Posting Maven Featured Poster

I've just posted in your other topic on that class, pointing out several issues with your code. (The thread you should have posted this in, btw, since having what is basically one question in several threads is confusing).

I'm not going to copy paste it here, but just add a link.

public void drive(double numMiles)
{
double gasNeeded = numMiles/mpg ; 
if(numMiles != 0 )
{ 
    mileage = mileage + numMiles ; 
}
 if(gasInTank> gasNeeded)
{
gasInTank = gasInTank - gasNeeded ; 
}
if(gasInTank < gasNeeded){
    gasInTank = 0 ; 
}
}

as pointed out in my other post, this method is an Exception in the making.
You've added code that updates gasInTank, which is good, but there is a flaw in your logic, so for now I'll focus on that.

 if(gasInTank> gasNeeded)
{
gasInTank = gasInTank - gasNeeded ; 
}
if(gasInTank < gasNeeded){
    gasInTank = 0 ; 
}

First thing to remember, and this is quite important, this check has to be done before you update the mileage. After all, the way your code is now, if you try to drive 500 miles, but only have gas for 50, still, your mileage will say you drove 500 miles.
Either your car should update the mileage with the exact amount capable of driving, or the car shouldn't drive when it doesn't have enough gas. Just because it's simpler, I'll go with the second solution.

As I explained in the other thread, none of this code should …

stultuske 1,116 Posting Maven Featured Poster

John: seriously, there is no need at all to revive dead threads. This will still pop-up in google, or by just using the search button on the top right.
If you only consider top-google results as resources, I recommend a different carreer choice.

stultuske 1,116 Posting Maven Featured Poster

if you are totally new to Java, maybe you should start with getting acquainted with the language.
It's a bit like learning to swim: if you don't know how, jumping in the deep end when noone else is around, might get you in trouble you can't get out of.

stultuske 1,116 Posting Maven Featured Poster

what ís the problem you need solving?

stultuske 1,116 Posting Maven Featured Poster

not to mention the fact that you should learn to write compilable code, before trying to implement algorithms.

stultuske 1,116 Posting Maven Featured Poster

It seems you had that problem, because your input was "neither an OLE2 stream, nor an OOXML stream".

Check the method for what it is expecting, and make sure you pass a valid parameter to it.

stultuske 1,116 Posting Maven Featured Poster

You have code like this:
catch(IOException ieeo){ }

and you expect us to go and debug it?

stultuske 1,116 Posting Maven Featured Poster

First of all, for jsp related questions, you should post in this forum.

If you just copied this code from somewhere: stop doing so and learn to write your own.

If this code is yours: remove all of that Java code out of the jsp. the jsp file is meant to contain UI only. It's good you're trying to learn to use servlets, but don't start learning this based on an application: start the way you did with Java itself: have a servlet pass a simple "Hello world" message for you to show in your jsp. It will be a lot easier to understand.

stultuske 1,116 Posting Maven Featured Poster

by writing the code?

stultuske 1,116 Posting Maven Featured Poster

NopeForever, no, that doesn't help.

array[j] doesn't print the index, it prints the value.
System.out.println(" " + num + " is in index "+ j);
should do the trick.

stultuske 1,116 Posting Maven Featured Poster

203428: you seem to be missing the concept of a forum like this. the point is, that if he has questions, he can post them here, so he can recieve help from thousands of developers.

at this point our problem is that we will not aid the OP into cheating his/her way through education.

stultuske 1,116 Posting Maven Featured Poster

congratulations ScottShip: you managed to copy paste your assignment. I hope you don't expect us to be to impressed by that show of skill.

stultuske 1,116 Posting Maven Featured Poster

ObSys: unproductive, yet realistic.
I was merely pointing out that 'basic Java' covers a whole lot more than just the primitive types, objects, collections.

I also pointed to the sticky threads especially created for people who are starting/looking for beginner projects. I assume that's what you referred to as 'unproductive'?

stultuske 1,116 Posting Maven Featured Poster

ehm .. no, you are not.
if you have never used xml or jdbc in a project, calling yourself intermediate is like calling a Smart a BMW.

if you go for a job interview and say you are intermediate, they'll expect a lot more knowledge.

stultuske 1,116 Posting Maven Featured Poster

Diafol: whether you agree with it or not, JWenting has as much right to an opinion as you or I. I assume he's referring to a lot of people who adore Mandela and treat him as if he never made a mistake in his life, or walked the 'path of peace' besides Ghandi, which is simply not true.

No matter how hard his people needed it, in their rebellion, they to took up arms and murdered people, not all of them actual enemies, but rather being looked upon as such, for the color of their skin and their financial position.

yes, he did a lot of good, no sense in denying that, but there's no reason to declare him a saint just yet. in the start of his rebellion against his supressors, quite some of his actions were just as misguided as theirs.

GrimJack commented: You might need some reading comprehension - disagreeing with someone is not denying their opion +0
stultuske 1,116 Posting Maven Featured Poster

what are you talking about, overlaping each String? what exactly is it you try to get?

stultuske 1,116 Posting Maven Featured Poster

you want them to run your source files?
if you consider that feasable, jumping to a career in java development might be a bit ... too soon.
first learn the basics, as in: what can we run, how do we run it, ...
depending on the type of application, provide a .jar file, or deploy a .war (... ) file somewhere, and provide the url.

stultuske 1,116 Posting Maven Featured Poster

Inhebriation
Never
Seems
Other
Mens
Nightmares
In
Action

weirdo

stultuske 1,116 Posting Maven Featured Poster

salomonsk8: not only are you incorrect, but you are bumping a dead thread.
what on earth makes you believe that an IDE that is used for Java development would NOT understand Java code?????
all the "skills" needed to have the above code in NetBeans is copy-paste.

riahc3 commented: Hello, Mr. Sense Of Humor -1
stultuske 1,116 Posting Maven Featured Poster

try running the code a hundred times after each other, you'll see.

stultuske 1,116 Posting Maven Featured Poster

looks to me like you don't have the appropriate driver in your path.
you'll need to add the .jar file containing these driver(s) to your project or your classpath.

stultuske 1,116 Posting Maven Featured Poster

if that are the only types of Java applications you know of, you have a lot yet to learn...

stultuske 1,116 Posting Maven Featured Poster

there will always be a call to the parents constructor.

XHellghostx:

public class B extends A{
// ... rest of the code

this is very basic stuff. each and every textbook, bundle with coursenotes, (decent) tutorial could have told you this.
what are you working with? do you use a book? are you taking lessons? or are you just playing around a bit on your home computer?

stultuske 1,116 Posting Maven Featured Poster

less than a day to understand and learn evrything there is to know about arrays

no, you don't. no teacher would ask you this, since noone can get all of that within a day. the basics, sure, but not everything. there are advanced things to think of as well.

also, those "questions" you posted aren't questions. they are pieces of code that come without questions.

next to that, did you write that code? if it's code your teacher gave you, tell him there 's no such thing as "global variables" in Java. so, make sure you get the basics right, before passing to more complex structures.

stultuske 1,116 Posting Maven Featured Poster

read my remarks, it shows why you're not really helping.

stultuske 1,116 Posting Maven Featured Poster

you thought hotmail/gmail/.... worked on magic?

stultuske 1,116 Posting Maven Featured Poster

that makes no sense. either it has a fixed length (the int you pass) or it might be cut off.

stultuske 1,116 Posting Maven Featured Poster

the procedure?
analyze
code
run

stultuske 1,116 Posting Maven Featured Poster

well ... the fact that you copy-pasted that code here would seem to beg to differ :)

techxaidz commented: wew +0
stultuske 1,116 Posting Maven Featured Poster

also: depending on your IDE to 'auto-complete' your code is a crappy way of writing applications. better taking a few seconds longer, but knowing and understanding what you wrote when compared to knowing 'NetBeans(/Eclipse/...)' 'll solve the problem for me.