aspose file tools*
The moose likes Beginning Java and the fly likes Can I get solution for this query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Can I get solution for this query" Watch "Can I get solution for this query" New topic
Author

Can I get solution for this query

Ravi Pydi
Greenhorn

Joined: Sep 01, 2002
Posts: 25
Write a Java Program that can print all the possible Combinations of a Digital LocK Key code which consists of 3 Numbers with the following constraints:
The Sum of the Numbers cannot Exceed 1000
No two numbers can be multiples of each other. Like 10 and 20 cannot be part of the Key Code.
Atleast One number has to a Prime Number in the Key Code.
Each Number should be greater than or equal to 1 and less than or equal to 500
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

Don't post homework questions. Those questions are for you to work out, so that you will learn from the experience. It is OK to ask for hints, but not for entire solutions.

-- How To Ask Questions The Smart Way by Eric Steven Raymond
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11418
    
  16

Break the problem down into smaller parts.

start off by figuring out how to print all the possible combinations. Note that you may NOT want to start with 1-500, but maybe something simpler like 1-5 for each value.

once you do that, add the constraints one at a time, test each as you go, and compile/test OFTEN.

come back if you have more questions... the more specific the better.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can I get solution for this query