I'm writing a program using Java and database software for a project. I am to write a program that looks at all the models of Lego that can be made from a certain set of blocks. That means if I have a set of blocks in a pack of Lego:
(BlockType - Amount): block1 - 100
block2 - 120
block3 - 80
block4 - 60
blockn - x
Then my program should be able to sort through the data and see that from my set of Lego blocks I can make either 3*Recipe1 and 1*Recipe2 or 1*Recipe1 and 2*Recipe2.
There will be a database containing all the recipes for different models and there will be up to about 50 block types. I know this looks a bit daft but this is analogous to my final project.
Before I go wasting my time getting to grips with mySQL, is this something I can use with Java for my project? Any information on whether this is the right way forward, or sources of information for newbs on the subject is greatly appreciated. Thanks in advance.
I just sent you a single SQL statement that hopefully proves it can be done
It's only a dozen lines long, and while it's not perfect, it should be adequate for this.
Can't really post it here otherwise the poor guy won't have that much to do.
Ah no - but it does show how many of each recipe can be made with the blocks you have which is what I thought he was asking! That will teach me to read the spec too quickly I was tempted to having another go but I suspect I'd be pushing the boundaries of what constitutes a single statement and I also suspect I'd be doomed to failure.