[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Missing post? - see this post about spam for more information.
Messages posted by: stdunbar
Forum Index » Profile for stdunbar » Messages posted by stdunbar
Author Message
I'm sure you're worried but posting like this sounds like "hey, I was out partying and just now decided to take my class seriously. Can you do my homework for me"?

If you haven't even tried you're not going to get help in time. And cross posting doesn't help either.
I'm not a big fan of having your containers hold Object classes but the basic concept will be:



this would create a Vector that would hold a Vector of Object classes. Then a Date or Integer could be put into there. Since stores Object it could also be another Vector.
You have two choices - either replace the array by re-allocating it:



or loop through the existing arrays and zero them out:

I'm guessing that this you're running into this using the browser, correct? I think you'll have to contact the web site owner for some help on this one.
There is a lot of code here. I'm not sure where to look for what you need help with. Your subject asked about removing elements from an array but I'm missing where you need help.

In general, it is a bit of a challenge to remove an item from an array. If you're not allowed to use the built in classes like ArrayList then your best bet is to copy the elements from the source array into a new destination array, skipping the item that was removed. There is also a array helper class that may help some too.
Remember that Java is case sensitive - there is no event class but there is an Event class.

And just some feedback - do yourself a favor and name your variables like a human is going to read your code. It doesn't cost anything to name your variables in a way that makes sense - 'a' is far harder to figure out than something like actionListenerEvent.
Just run it - I'm missing the issue.
And your question is?
Remember that when you accept() a connection you communicate on that Socket, not the ServerSocket. So the traditional way is to have a thread to handle each client. I started a how to on this years ago - I should finish it but basically you'll spawn a thread for each clientSocket and handle the client that way. The thread can live as long as your protocol wants - usually for the life of the conversation.

Well, you've successfully posted your homework assignment - if you don't know even the first step then it's time to talk to the instructor. Take it one step at a time an let us know where you get stuck.
It looks like all you have to do is change the "image" param to be a different image. I would think that Javascript would be one way to do this - you could dynamically change the parameter from a list of known images each time the page loads. Or, perhaps simpler, depending on your server side language (JSP, PHP, etc.) you could put a value in there at page generation time from a list of known images.

What is your server side language?
Well, you've done a great job posting your homework assignment - what do you need help with? What have you done so far? This is a help forum, not a do it for me forum.
Not with the current way you have main() coded. You would need "getters" for those variables:



And, if you want to be complete - you'll need "setters" too so that if I have an instance of an AlexHouse1 class then I can set the height and so on.
No, it would just be simpler to have two separate files:

AlexHouse1.java


LivingRoom.java:


The other thing is that the "protected" keyword is important to understand when using inheritance. With it your LivingRoom class would be much simpler:

AlexHouse1.java:


LivingRoom.java:


In this way the parent class "holds" all of the data and the derived class just changes what it cares about.
Remember that only your main() method is really "run". You're also making your life a bit harder by having the classes embedded but I was able to get this to work with:

 
Forum Index » Profile for stdunbar » Messages posted by stdunbar
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2012 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle