|
|
#1 |
Member
Join Date: Sep 2011
Posts: 93
|
|
|
|
|
#2 |
Forum Staff
|
I'd say, partially it depends on the programming language used, but generally I'd start off with designing DAOs (Data Access Objects), which provide basic database queries. I guess you won't really need much more than the record select.
You then have the layer which receives this result and does your calculations. Save your result Record in a class and work with a list of (for example) RecordClasses then. It's important to abstract layers. You can code each of them individually and put them together after, or whatever way you like, but assure one layer works (maybe with Tests). Let me know if that helped you!
__________________
Programming section moderator.
Also resolving issues in Marketplace section. Playing DotA since 2005. |
|
|
|
#3 | |
Member
Join Date: Sep 2011
Posts: 93
|
Quote:
|
|
|
|
|
#4 |
Forum Staff
|
I'm not sure if i understood correctly, but you have to sum up to a certain value?
This depends on how well distributed your values are, e.g. if your values make it possible, sum up as long as you get over your value, then remove a value to get to the exact sum, or remove to get lower and add another one to sum it up. I hope this helps, but maybe i misunderstood totally.
__________________
Programming section moderator.
Also resolving issues in Marketplace section. Playing DotA since 2005. |
|
|
|
#5 | ||||||||||||||||||||||||||||
Member
Join Date: Sep 2011
Posts: 93
|
Let's say that I input the following:
# Records: 5 Quantity: 15 Total Cost: 800 Then It should Output something like this: (Record Name and Price is from a database while Quantity is randomly generated)
As of now the random selection of records and quantity works, but I have no idea on how to make the total cost equal up too. Will looping the quantity randomization work or will it just make an endless loop? Does it have to use a really complex selection system or what? |
||||||||||||||||||||||||||||
|
|
|
#6 |
Forum Staff
|
I described a way of doing it. Randomization loop will work also if you have a half-decent random function!
__________________
Programming section moderator.
Also resolving issues in Marketplace section. Playing DotA since 2005. |
|