Jon Benedetto

Greenhorn
+ Follow
since Jan 28, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jon Benedetto

My assignment is due tomorrow. I asked my professor for help but he hasn't contacted me back yet. Can someone please send me the code, or how to construct it soon?
Thanks
14 years ago
Okay I figured out a couple of things. For instance, as stated in the problem, the program works like a real lock. So you have to make a "counter" that will record how the user got from 25 to 35. What i mean by this is if the user went clockwise from 25 to 35, it would record that the user went 30 units. If the user moved counter clock wise, then it would be able to recognize that the user went counter clockwise, because it only moved 10 units. I came up with a formula that will be able to detect this.
For this example
int distanceMoved(direction,position,destination)
P= position
d= direction
Destination= Cw(Clockwise) CCW=(Counter clockwise)

Table:
P>D
P<D
Clockwise
P-D
40-(D-P)
Counter clockwise.
40-(p-d)
P-D

SO can someone please put this together, I am having a very hard time. THanks.
14 years ago
Yea I know, I can't figure out what to put, thats why I am asking. Please give me hints on what to put where to make it works.
THanks
14 years ago

Rob Prime wrote:Jon, it's [code], not [javadoc]. You can edit your post to change these tags.


Thank you lol I was wondering how they got the Pictures like that.
14 years ago
In my 5 years of programming with java, I never found an easier way to do it. There is only two ways I know how to get data and the array would be the quickest.
14 years ago
Here is the assignment for the program that we had to make:
Specify, design, and implement a class that can be used in a program that simulates a combination lock. The lock has a circular knob with the numbers 0 through 39 marked on the edge, and it has a three-number combination, which we'll call x, y, z. To open the lock, you must turn the knob clockwise at least one entire revolution, stopping with x at the top; then you turn the knob counterclockwise, stopping the second time that y appears at the top; finally you turn the knob clockwise again, stopping the next time that z appears at the top. At this point, you may open the lock.

Your Lock class should have a constructor that initializes the three-number combination. Also provide methods:
(a) To alter the lock's combination to a new three-number combination.
(b) To turn the knob in a given direction until a specified number appears at the top.
(c) To close the lock.
(d) To attempt to open the lock.
(e) To enquire about the status of the lock.
(f) To tell what number is currently at the top.







I have completed the Testlock I just need help with the Lock Class. I have both of them enclosed in the file. Please help me.
Thanks,
Jon
14 years ago