Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Verifcation

 
Lucas McDaniels
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying to figure out if the picture z and the zebra are in the rectangle.


 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My first suggestion is a Short, Self-Contained, Correct Example (SSCCE).
 
Unnar Björnsson
Ranch Hand
Posts: 164
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whole lot of code, with many repetitions, are you sure can't achieve the same functionality with fewer lines of code?

For example, by putting the x' and y's in an array and making use of a single while loop instead of tons of if-else statements


Or something similar>
 
Lucas McDaniels
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
marc weber wrote:My first suggestion is a Short, Self-Contained, Correct Example (SSCCE).

okay i think the updated code is what I want with the SSCCE, but am still stuck on where to start the process of verifying that the z is in the rectangle along with the Zebra picture.
 
Lucas McDaniels
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unnar Björnsson wrote:Whole lot of code, with many repetitions, are you sure can't achieve the same functionality with fewer lines of code?

I tried to put the picture into an array, but couldn't get the pictures, trying the x y array but with no uck,
http://download.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html, and intro to java applets about arrays(http://www.cs.colostate.edu/~boese/JavaApplets/), Plus a few things from Google on java arrays. But it was confusing, anyone have a good easy to understand doc on arrays?
 
Lucas McDaniels
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to verify that the image "z" is next to the image "zebra" and so on. any help would be greatly appreciated.


 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll help, but I would like more info first.

Before I spend time attempting to figure out your 230 lines of code, why don't you tell me where your problem is? What attempts have you made to debug this yourself, and what values do you get that you do not understand?

This is partly because I don't want to spend my time figuring out stuff that is not related to the SPECIFIC problem, and partly because we do get people here from time to time that want us to do their programming for them. I don't want to spend my time doing that when I might be spending time helping people who are trying to help themselves and just need some (specific) questions answered.

Put another way -- I don't find the question specific enough. Other people might. But I think you're more likely to get help from more people if you narrow what you're asking for.

rc
 
Lucas McDaniels
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alright The applet puts ten pictures on the JPanel randomly, then you can drag the ten pictures around. they are 2 sets of five, one being animals. The other is the letter associated with the animal, z for zebra. Which is running correctly. The next thing I would like to do is check to see if the user actually put the z next to the zebra, not the letter o next to the zebra. So what I guess I am asking is the logic behind it, not for actual code, I just don't know where to start.

EDIT:
was trying rectangle, and seeing if it contains picture[0] && picture[1] but i was not getting the response I was expecting.
 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I'm going to try one guess, even though I still don't have enough information.

You have code that (you say) handles a drag of a picture from one place to another. And you want to know whether that picture and another picture ended up next to each other. Can't you, at the end of a drag operation, put the location of the dragged picture somewhere, and then look at it when it's time to figure out if it's where it's supposed to be?

You've given me (us) a start on what your program is attempting to do, and the fact that you "don't know where to start". Well, I'm not sure either, since what your program is to do is still pretty vague in my mind. If you want a place to start, then perhaps start by telling us the data structures and algorithms you've already got.

rc
 
Lucas McDaniels
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Resolved, still not what I would like but it does what I wanted.


Thanks To everyone that helped me jog my brain for ideas.


Final code:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic