# Justin Robbins

Ranch Hand
since Feb 15, 2016
For More
Cows and Likes
Cows
2
In last 30 days
0
Total given
0
Likes
1
0
Total given
16
Given in last 30 days
0
Scavenger Hunt
Ranch Hand Scavenger Hunt
Greenhorn Scavenger Hunt

## Recent posts by Justin Robbins

Carey Brown wrote:So if you know the Player who scored what difference does it make which Game or which Team?

I think the points gets calculated differently for each individual team the player plays for.
7 years ago

Paul Clapham wrote:Carey has pointed out some of the problems with your implementation of that method, but I have to say that I don't understand what the method is supposed to be doing in the first place. Even after reading your description several times I'm still lost.

I don't understand what it means for a team to be playing between two other teams, for one thing: you said

I want this method to be called to show that thePlayer has scored a goal for wat_Team, that is playing between the first_Team and the second_Team

But probably I've misinterpreted what you meant to say there. So let's take an example. Suppose first_Team is "Manchester United" and second_Team is "Toronto Maple Leafs" and wat_Team is "Portland Trailblazers". Can you explain what we should be looking for to see if that's a valid combination, or whatever? Remember I don't know what a Game is in your data model, sometimes you describe it as if it's supposed to be taking place right now but other times it seems like it could represent a game which has already taken place.

Player can play for either team. And whatTeam refers to the team that player is on. It was confusing wording sorry.
7 years ago

Carey Brown wrote:I think some use cases would help get you in the right direction. Example (you'd need to tell us if these are in fact correct):

• A Team consists of a number of Players
• There is one-or-more Games G where Team A plays Team B
• Player P could play for different Teams for different Games
• When Player P scores his/her score count needs to be incremented

• more?

Yes, the team class has players.
There are more or more games where Team A plays team B.
Player P can play with different teams for different games.
Player P's score count needs to be incremented.

Yes to all. I just don't know how to achieve that. My OO is weak.
7 years ago

Junilu Lacar wrote:1. Don't get cute with names. I'm not sure what you're trying to convey with a name like wat_Team but it gets old after reading it a couple of times.

2. The design of this method smells to high heaven.  Java is an object-oriented language. With as many different objects that you have involved here, this is not at all an object-oriented way to accomplish anything.

I know I need help badly. How can I clean this up and stay true OO design principles?
7 years ago

Carey Brown wrote:On line 11 you create a new Player 'p', but then throw it away without doing anything with it.

with the loops I want to check if there is a game in which the first and second are playing each other, if not then false.
If there is a game between them I want to check if either of those team names are "whatTeam", if that is the case I then
want to add a goal of 1 to the player player in the parameter, to which the fourth parameter refers to in between the two
teams referred to in the first two parameters.

7 years ago
I have a class called GameCollector which adds up all the points between rival teams. I also made a Game class that has a constructor that takes in two separate strings to represent teamOne and teamTwo. And also a Team class with a constructor that has four parameters, string teamName, int totalGoals, int games, and int wins. And a player class that has a constructor with parameters String name, int goal, String team. Inside the GameCollector class I have this method:

Not sure if this method is implemented right but I want this method to be called to show that thePlayer has scored a goal for wat_Team, that is playing between the first_Team and the second_Team. With a goal being +1. A false boolean should be figured out through if first_Team and second_Team are not playing against each other. Of course, if both firstTeam and secondTeam are currently playing a game but whatTeam isn't the name of either, it should return a false boolean. But if those check out then a score should be added to thePlayer that the whatTeam refers in the game between firstTeam and secondTeam.

Thank you

7 years ago
This method is used to remove the value toRemove from the array. The remaining elements should just be shifted toward the beginning of the array. Since the array will now have one fewer element, the position of the previous last element should just be filled with 0. If there is more than one occurrence of toRemove in the array, only the first occurrence should be removed.

It's hard to pick out one line that confuses me. Could someone please explain what each line of code is doing?

Thank you
7 years ago
Hello there!

Am having a little trouble understanding selection sort want to make sure I am following correctly.

Found the code, just trying to conceptualize it, so imagining we pass in an array such as: 9,5,2,7,1

And then we carry on to iteration 2, then 3 then 4 each time doing a inner for-loop to find the proceeding smallest value ahead of its index.

A major thing I don't get is how is this updating a list? like how is it being saved to eventually return a sorted list?

please tell me if I am misunderstanding anything
Thank you
7 years ago
So the array at index 0 is assigned to the VALUE part, not the array itself, at index 1. Idk it really confuses me to think of one array being assigned to another array.
7 years ago

Carey Brown wrote:Swap looks more like

At the end, v1 contains 5 and v2 contain 9.

Thanks!
So it's simply assignments happening here. What's on the left get's assigned to what's on the right, like that?
So we say that temp will hold on to the value that the array has at that specified index.
and then say that, that array index is to be assigned with the array index next to it? so even though they are both array[index] you can assign one to be WHERE it's at and the other to be the value?
so it's more like
array[0] = 5;
instead of array[0] = array[1]; ?

it confuses me to see an array assigned to another array, like what's even happening there. Is one array becoming another array? massive confusion about it.
7 years ago
Hello

I am trying to see if I understand bubble sort correctly, also there many gaps in my knowledge that I hope people can fill in.

I found this bubble sort code online and am now trying to analyze how it all works.

when we do this swap is, is temp = arr[i] at that moment an integer or the index or element itself, so confused about that. Don't understand what it represents right then and there.

Say we have the unsorted array: 9,5,2,7,1

here would that code look like:

I know it's suppose to be a swap, but I am just not seeing how that happens there.
we say our temp is now the value of 9.
It's strange to see a value on one side and then the variable name on the other.
Would it be the same to say temp = 5; at that point?
I am quite confused about arrays.

How exactly does this output a sorted array at the end of it all?

7 years ago
I am getting a null pointer exception for:
7 years ago
Made a graph for a maze. But I am somewhere missing an edge cases, maybe a few and there is an infinite loop inside this code. I've been at this for hours I cannot seem to find the edge case or where the infinite loop inside in the code. I seriously need someones help. Where is an infinite loop/edge case here.

Thank you

7 years ago

Understood.
Probably doesn't make much sense for when the Dog class is created to compare it <T> things? does it? when we implement its Comparable interface, we want things that can compare with what they are so when they are passed into the <T> parameter we can easily compare them against their own type not someone else's. For example all Strings, or all Dogs or all Integers we want one type and one type only. So what they originally must have been is comparing themselves.

Example:

The only things that go into that T type are only which implement the comparable interface and that when they implemented the comparable interface they did so with comparing things of their same type.
7 years ago
Also, one person told me it's the first now I hear it's the second. Please I need to fully understand this concept.
7 years ago