# Can I get solution for this query

Ravi Pydi

Greenhorn

Posts: 25

posted 11 years ago

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

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

posted 11 years ago

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.

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