• Post Reply Bookmark Topic Watch Topic
  • New Topic

Combination Lock  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys, I thought I'd ask you guys over here because I am legitimately stumped here. I have been working on this the last few hours and cannot get it to work for the life of me, and I was wondering if you guys could help understand what exactly I am doing wrong. We were given a tester file (it cannot be changed) to base our work off. I am really in need of some help, and it would really be appreciated. we are being asked to create a lock that only unlocks when 3 of the correct positions (combos) are hit. I'm still a beginner at Java and have tried everything I know in my arsenal and am still stuck. Heres the question exactly:

combination = CAT
The lock can be opened with: CAT, BIGCAT, ACAT (since the last three letters entered are right)
The lock cannot be opened with: EAT, AAT, CAG, CATDOG (since the last three letters are wrong)
By default, the lock is perfect in that it responds only to the correct combination. However, a lock can
be created with a combination and a tolerance. The tolerance specifies how much “slop” is in the dial,
that is, the total amount that the user can be off in setting the dial and still succeed in opening the lock.


Its not compiling at all. They are mostly Syntax errors as well as type issues that I am having problems with at the moment.

Here is the Tester file:


And here is what I have done so far:



Once again, help on this would really be appreciated! Thanks in advance!

 
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

It looks like you're doing the same assignment as was discussed in these posts:

Unsure of where to start - New Java Programmer
Method creation trouble
 
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its not compiling at all. They are mostly Syntax errors as well as type issues that I am having problems with at the moment.

Please post the errors and stack traces so we can see what is wrong and explain to you what the errors mean.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!