BestJewSinceJC 700 Posting Maven

You are correct. . the user will have to wait for the file transfer. You might want to consider putting this on a separate thread.

BestJewSinceJC 700 Posting Maven

Yes, he means to use the Object instead, because not only can you send and receive primitive types, but you can send and receive Objects. With the Data one, you can only send and receive primitive types.

edit: And I'm not sure what you mean by "how to change the headers"

BestJewSinceJC 700 Posting Maven

The for loop with only 20 iterations is not going to cause you trouble. One of the methods called from inside the for loop might, however, or calling the method that contains the for loop repeatedly. Have you actually checked to see how much your .exe is using? And where is your main method?

BestJewSinceJC 700 Posting Maven

DataInputStream
Object Input Stream

It looks like James has answered your questions for now, so I'll point you towards some good resources. I don't know whether or not you've already been looking here, but this is a good place to learn Socket programming.

BestJewSinceJC 700 Posting Maven

Couldn't you also use getClass or instanceOf to tell which type of Object it was?

BestJewSinceJC 700 Posting Maven

Yeah, no problem. If you don't have any more problems you can set this to solved.

BestJewSinceJC 700 Posting Maven

The manifest file specifies where the main class is, that way the program can run as you want it to. And netbeans generates the manifest file for you, so you don't see the details of it, but I'm sure that it happens. The manifest file can also do other things, I think, but I'm not sure what they are. See here for more info:

http://java.sun.com/docs/books/tutorial/deployment/jar/appman.html

BestJewSinceJC 700 Posting Maven

Please post your code in code tags, following the rules that can be found in the stickies at the top of this forum.

:)

BestJewSinceJC 700 Posting Maven

Oh, I see what you are saying now. I think that will work. . I'm going to just try adding "new JMenuBarClassName". . or adding the JPanel class to the panel as a template. . one of those things might work. I'll let you know.

BestJewSinceJC 700 Posting Maven

I'm really not sure what you are asking. To attach a JMenuBar to a JFrame, you just make a new JFrame form then drag a menu bar onto it. Then you can highlight the menu bar and add things to it with the palette.

BestJewSinceJC 700 Posting Maven

It depends on what programs you are running and what is taking up your RAM. Vista definitely isn't using more than a gig, so I would say it is probably bad. But like I said. . it depends what you are running.

BestJewSinceJC 700 Posting Maven

The most important advice you can remember when you're learning is not to get overwhelmed, and break your task into smaller parts, like James has suggested. That way, you can look up how to do each individual part, if necessary, and you can make progress on the problem.

BestJewSinceJC 700 Posting Maven

C is hard for everyone when they are learning. I'm relearning C, and it is hard for me again. But don't get frustrated with the people trying to help you. You can disagree if you want, but if you need a more simple explanation, ask them to break down whatever you're having trouble with further.

BestJewSinceJC 700 Posting Maven

JW1234:

Binary code and machine code are the same thing.

BestJewSinceJC 700 Posting Maven

Yeah, no problem. Ezzaral basically handed me the easy solution though. :p Mark the thread as solved. . ? (I haven't solved one in a good while. . lol)

BestJewSinceJC 700 Posting Maven

No, you didn't sound argumentative.

:)

But we hijacked this thread. Oops.

BestJewSinceJC 700 Posting Maven

There is your problem. You can't execute all three because testcircle is the only one with a main method. On top of that, I don't think you can execute more than one class at once with the java command. Just change it to java testcircle

BestJewSinceJC 700 Posting Maven

You're using netbeans or no? Either way, JFrame has a method called setJMenuBar, and you pass the JMenuBar you created as the argument.

BestJewSinceJC 700 Posting Maven

So you're saying that "args" is now being passed correctly, but that the database isn't working as you expected? In that case, I can't help you any further. . you have an entirely different problem now.

BestJewSinceJC 700 Posting Maven

The documentation you just provided says that it is consistent, but in some cases, EOF can also be used to report errors. So either way, I don't see how you're getting burned. Care to explain? (Are you just saying you can use it to make sure it isn't an error? If so then no explanation needed. The consistency bit could be interpreted differently though)

BestJewSinceJC 700 Posting Maven

If you call the main method with Classname.main(args) it will work. Are you still getting any errors?

BestJewSinceJC 700 Posting Maven

You declared the array incorrectly. String[] args declares an array of Strings called args that has no memory allocated to it. So basically, you named the array, but did not give it a size. You can change String[] args = null to String[] args = new String[1]; and then use args[0] = R.getString("uname"); and it should work.

BestJewSinceJC 700 Posting Maven

It might help if you pasted us the entire error message, which would probably include the line number at which this happened, and perhaps other relevant information.

BestJewSinceJC 700 Posting Maven

I understand the logic of what you are saying. But I'm not sure how this can be accomplished in netbeans. . through drag and drop, and their 'auto' type features. I could edit the code myself but it might cause layout problems since I'm using GroupLayout. I created the menu bar and all of the menu items just by dragging and dropping.

BestJewSinceJC 700 Posting Maven

Error 1: Your class extends an abstract class, so you need to implement the abstract methods in that class. So basically, look at the AbstractCollection class, and make sure your class has all of the methods that AbstractCollection lists as 'abstract'.

Error 2: Your method has to return a boolean value. In Java, boolean values are declared as boolean variableName = true; or boolean variableName = false. You have to return a boolean.

Error 3: I have no idea. Usually this message means you are referring to a variable that doesn't exist within that method or class.

As for your other problems, you aren't saying anything that can't be grabbed from a project description. You said you 'knew the logic', so start programming. If you don't know how to implement a specific piece of logic, ask for help on that. "In order traversal" is not specific. (Yes, I know what inorder traversal is, but it has multiple steps - if you need help with doing one, you should be providing some code and asking about it, etc)

BestJewSinceJC 700 Posting Maven

I'm using the same file menu with the same menu items in multiple places. As such, they should have the same actionListeners etc since the same windows should open when they are clicked. How do I get netbeans to automatically do this (make them all use the same events and such)? Note: In some cases, I made the menu a template and re-used it, in other places, I just added a new menu and added the menu items again.

thanks

BestJewSinceJC 700 Posting Maven

That is exactly what I'm saying. . you have to use a print statement or a GUI to make it display anything. To read about what Exceptions are, look at the lectures on Exceptions. They are fairly easy to read. http://www.cs.umbc.edu/courses/undergraduate/202/spring09/MiscPages/schedule.shtml

BestJewSinceJC 700 Posting Maven

I took a look at your problem yesterday, but I can't say I remember enough about the data structure to be very helpful as far as the logic. But if it is the syntax you are struggling with, ask a specific question about what you are trying to accomplish (as far as the logic) and I'd be glad to help you with it.

BestJewSinceJC 700 Posting Maven

Also, the "Working as it is supposed to" is just a figment of your imagination. If it doesn't work the first time, it is just tricking you the third time. Hehe.

BestJewSinceJC 700 Posting Maven

Not trying to argue with you, just for the sake of a good discussion, I don't think it is polymorphic either. Polymorphic would mean that the method which gets invoked depends on the type of Object. (i.e. the classic example with Animals where which Animal's speak method gets called depends on what subclass (Dog, Cat, etc) of Animal the Object is). You are invoking the same method regardless of the type of Object.

BestJewSinceJC 700 Posting Maven

It is possible, but first, you have to verify the Object's type, then cast it. That isn't Generic code.

BestJewSinceJC 700 Posting Maven

No, that is not correct. You can return any subclass of Number if the return type is declared as Number. But the point made earlier still stands.

BestJewSinceJC 700 Posting Maven

Well, good luck then. I don't know what half of the methods you used are supposed to be doing. I don't know why you'd want to insert something at the tail of a linked list as part of a multiply method. And I don't know what the split method does, sounds like it splits a String into parts, but I also don't know why you would want to do that. If you explain what each section of that code is doing and how you're attempting to multiply the polys, I'd be glad to assist you further. Or you can wait for someone else who understands whats going on. Completely up to you. Either way, good luck.

BestJewSinceJC 700 Posting Maven

You can use an Object of the class Scanner to read in the names from the text file. Store them into an array. Then you can write a search method to search for a name based on what the user inputs. This method could be as simple as checking to see if the String that the user inputs is equal to any of the Strings in the array, using the equals method of the String class.

BestJewSinceJC 700 Posting Maven

You can write an equivalent method that takes an array of Doubles. James' comment was making the point that by doing so, you are not really writing "generic" code. Generic code should provide methods that can work for any type of Object. Hence, it is "generic". If you read the lectures you'll gain a better understanding of what I'm talking about.

BestJewSinceJC 700 Posting Maven

You use Ezzaral's suggestion to store the polynomials in the linked list, using the power as the index, and the coefficient as what is stored at that index. Then you modify my suggestion from above, it would look something like

for (int i = 0; i < firstLinkedList.size(); i++){
for (int j = 0; j < secondLinkedList.size(); j++){
- Multiply i * j. Store the results in a linked list where the index represents the power, and the number stored at that index represents the coefficient. If there is already a coefficient at the index you are trying to store something at, then add it to that number and store it there.
}
}

BestJewSinceJC 700 Posting Maven

I got this off of another forum, from what I remember of Data Structures, it is the correct information on how to do a breadth first search of a tree. Their directions indicate that the tree is Binary (only has two nodes), but you can use the same algorithm on your tree, just add every node from left to right. As it says, it uses a queue to store the nodes during the breadth first search. You should make a random tree on paper and apply this algorithm to see how it works.

1. Add root node to queue if not null
2. Check if queue is empty, if not remove first item from queue which will be the root node initially and store it in a variable called currentnode
3. Print the value currentnode
4. If currentnode has leftnode, add leftnode to end of queue
5. If currentnode has rightnode, add rightnode to end of queue
6. Processing of currentnode finished, jump to step 2, rinse and repeat

Oh, and if you don't know how to make a tree, you can do so by making a 'Node' class that has two items: The data that is at the current node (this might just be an Integer), and an ArrayList of the child nodes. You'll have to implement an 'addNode' and a 'removeNode' method, maybe more methods.

BestJewSinceJC 700 Posting Maven

Why are you throwing an exception, specifically, an UnsupportedOperationException, for your Animals' move and eat methods? You should be using print statements: System.out.println("A fish eats other fish"); or using the JOptionPane.showMessageDialog method.

BestJewSinceJC 700 Posting Maven

What you want to do does not make sense then. You wouldn't expect the ArrayList class, which is generic, to add up all of the numbers in the array for you. The purpose is to provide a container, not to have specific implementations.

BestJewSinceJC 700 Posting Maven

With the class you have defined, you can use something like. .

public int addInteger(){
		int result = 0; 
		for (T i: numbers){
			Integer j = (Integer)i;
			result+=j;
		}
		
		return result;
	}

This is where 'numbers' is defined as an ArrayList<T>.

BestJewSinceJC 700 Posting Maven

It does get you arithmetic capabilities from within another class where you instantiate an Object of that generic class.

BestJewSinceJC 700 Posting Maven

Your project description makes it clear that you are supposed to make a class to contain the information, then have an array of that class type in your Video Store. I don't know why your professor would disagree with his own project description, either way, I'm done with this now.

BestJewSinceJC 700 Posting Maven

Try not to make duplicate threads:
http://www.daniweb.com/forums/thread185363.html

And I honestly cannot follow the code you wrote at all. I provided a solution for you that should work nicely in the other thread, though.

BestJewSinceJC 700 Posting Maven

Ok, I see. It looks like you are over complicating it though. If you use a nested for loop, you can go through, multiplying each number, and storing it in an appropriate place.

for (int i = 0; i < firstPolynomialsSize; i++){
for (int j = 0; j < secondPolynomialsSize; j++){
- Multiply i by j. Store the results in an array where the index represents the power, and the number stored at that index represents the coefficient. If there is already a number at the index you are trying to store something at, then add the two coefficients and store it there.
}
}

If this does not make sense, maybe you should try a simple example on paper, following the code I just posted.

BestJewSinceJC 700 Posting Maven

To multiply two polynomials, you need to multiple each part of the first polynomial with each part of the second polynomial. This requires a for loop. And when you multiple polynomials, you need to add their exponents. I don't see you doing either of those things. . ?

BestJewSinceJC 700 Posting Maven

If you want to do this Generically, consider this code as an example:

public class GenericNumbers<T>{

	private T number;
	private ArrayList<T> numbers = new ArrayList<T>();
	
	public GenericNumbers(){	
	}
}

If that does not make sense to you, read the two lectures on Generics found here (they are easy to understand):
http://www.cs.umbc.edu/courses/undergraduate/202/spring09/MiscPages/schedule.shtml

osjak commented: Helpful, thanks! +2
BestJewSinceJC 700 Posting Maven

This is not a homework completion service.

It depends. If he posts it in the 'paid projects' section it will quickly become one. ;)

peter_budo commented: Good idea, where did I out details to my PayPal ;) +17
BestJewSinceJC 700 Posting Maven

I'm not sure I understand your problem. You're trying to count the number of times each number was rolled? And find the percentage of the time that each number was rolled? If that is the case, keep an integer array to count the number of times each number was rolled. The indexes can represent the number, and the value stored in that index can represent how many times you rolled that number.

edit: I see you're doing what I suggested, kind of. But keep in mind it is impossible to roll a 0 or a 1 if you're counting both die as the roll.

BestJewSinceJC 700 Posting Maven

Maybe if you read the rules you will know what people mean when they say put your code in code tags.

BestJewSinceJC 700 Posting Maven

You do not have a main method, so how do you expect your code to do anything? Write your main method, following Peter's advice, then get back to us