Please use code tags to format the code so it is easier for us free helpers to read your program.
You mentioned that you need help, but you forgot to mention what problem you have.
So what is your program doing different as it's supposed to do? Where is the error message? Where are you stuck?
User Profile
Collapse
-
Show us what you have done so far (list you code here) and tell us where you are stuck, then we will help. If we spoonfeed you the solution then you won't learn!Leave a comment:
-
Show us what you have done so far (list you code here) and tell us where you are stuck, then we will help.Leave a comment:
-
What do you think?
Just post it here and I'll tell you if it's right or wrong and how you can improve your answer.
I know the answer, but if I give you the answer here, you won't learn, and that's why someone has given you this question.
Hint: it has to do with "object types".
Justify.
(Justify why you want the spoonfeed answer and not figure it out yourself :-) )Leave a comment:
-
Please use code tags to make it easier for us free helpers to read your code.
You have two variables "pointsHuma n" and "pointsBot" , but you have not listed the code where they are defined and where they are printed out. Maybe you count up, but at the end you reset them to 0 by accident?
So the first thing you should do is to add two methods...Code:increaseHumanPoints() { pointsHuman++;Leave a comment:
-
Show us what you have done so far (list you code here) and tell us where you are stuck, then we will help.Leave a comment:
-
Please use code tags to show your code formatted here, else it's wasted time for a free helper.
You have called your class "Employee", without s at the end. So if you try to start "Employees" , with s at the end, it will not work.
Can you please write down here how you start it? From command line instead of IDE? Then maybe you also forgot to compile it first.
You should compile and start it...Leave a comment:
-
In your for-loop, you start with i=0.
Then you define j=i-1, that means j is now -1
Then you access arr[j], that means arr[-1], which crashes since array indexes must always be positive.
Please note that (j>=0) is evalutated afterwards. If you put it first, then it would be evaluated first and the second term would not be evaluated because of short-circuit-evaluation.
So
would...Code:while(j>=0 %% k<arr[j])
Leave a comment:
-
-
Just research about arrays in java (make some exercise not related to the problem) and when you know how they work think, then about how you can use them to make a payroll system.Leave a comment:
-
"vertex[numberOfVertice s] == null;" is a mistyping. It should beA single equal sign is an assignment, whereas a double equal sign is a comparison.Code:vertex[numberOfVertices - 1] = null;
the purpose:
When you shift all elements one index up in your array, the last element should not be duplicated.
let's say you have 5 elements. And you want to delete the third one.
before the for-loop:
...Code:a[0]
Leave a comment:
-
Please show us what you have written so far and we will help you where you have problems.Leave a comment:
-
About fetchVertex:
In line 1 there is written "int". That means you cannot return "false" in line 4 and you cannot return a Vertex in line 6, you must return an int.
That's the reason your code didn't work.
But I think this method should not return an int but the vertex itself.
So the corrected method is:
...Code:public Vertex fetchVertex(int vertexNumber) { if(vertex.lengthLeave a comment:
-
You have a function fetchVertex(int n).
That's easy, just return vertex[n]. (change your return type from boolean to int)
I thought you need a function fetchVertex(Ver tex target), which finds the index of a vertex inside the array. For that you would have used a for-loop as I wrote.
Deleting a vertex:
add following code before line 16:
...Code:int numberOfVertices = vertex.length; for(int i=0; i<numberOfVertices-1
Leave a comment:
-
Why don't you take the code that I wrote as a template and I help you to extend it to your needs if you run in further problems?
Why still using arrays and not using collections and generics for this problem?
Why using a hammer to drill in screws?
Maybe your main intention is not to solve the problem. Your main intention is to learn how to deal with arrays and you just see the problem as an exercise example. Then I...Leave a comment:
-
if you only have a hammer everything looks like a nail. Don't repeat the beginners mistake and put everything in arrays. Use the collection framework of Java instead.
I assume that vertex n corresponds to edge n, so keep this data together!
I have seen enough bad code where programmers put employee first names in one array and employee last names in a second array and then messing around with the indexes when inserting/finding/deleting,...Leave a comment:
-
That code is better, (especially the placement of the numStepAdd computation) but not quite what I meant regarding the handlers.
You must make sure that the handlers are only initialized once.
And you don't need the second handler, you can do it all in one.
And after a handler was run, it must restart itself. You can do it in the main() method or for example in the constructor of a class.
You have your step-method inside...Leave a comment:
-
Please use coding tags around your code (the CODE-button, right next to the picture icon in the editor), so it is easier for me to refer to it by line numbers.
The calculation of "numStepsAd d" is inside the step() method an will only be calculated once in the beginning. The method will not be called again, so numStepsAdd will never change. Your handleradd will be called every 15 minutes, but will always print the same. to...Leave a comment:
-
We are here to help you if you are stuck, not to do the coding for free. So show us what you have so far (list your code here), tell us the problem in this code, and we will help you.
To give you general advice how to learn developing such a program, we need more infos from you (your klnowledge level in java programming, especially the graphics, and android knowledge)Leave a comment:
-
What don't you understand after googling each topic?
Can you be more specific about your problem?
I think that copying a whole book chapter as an answer of this unspecific question doesn't help you.
Why don't you write a small program trying out how a stack works and then come back to us if you are stuck, showing us what you have written so far?Leave a comment:
No activity results to display
Show More
Leave a comment: