Good day all.
I need help with JavaScript (I did study it back in University over a decade ago).
I’m currently refreshing myself on the JavaScript syntax so everything’s coming back to me slowly.
The thing is I have a problem and the scope is beyond my capabilities. While i don’t have any reference code to post here, I would like assistance in how to approach my problem and solve it.
My problem:
I can declare 5 items types and their quantity will be 15 each.
Of the 5 item types the 5th declared item cannot be stored in the “Container” mentioned below.
I have 5 boxes - each box has 2 compartment and can store 5 of 1 item type and 3 of another item type. You can only store 2 different item types in each box.
eg. box1: item1 +5 and item 2 +3.
I have 1 container that can store 7 of 1 item type and 7 of another item type.
You can only store 2 different item types in this container.
I have 2 Special Containers.
Special Container 1 can store 12 of 1 item type.
Special Container 2 can store 9 of 1 item type.
Both Special Containers cannot store the same item type.
With the mentioned items above i want to be able to:
Declare the 5 item types.
eg. item1: Orange
item2: Apple, etc.
I want to be able to select which box/ container/ special container, that i can place the items in.
I may only select for example 1 or 2 boxes, the rest of boxes or containers I don’t select can then be filled in automatically with the declared items/ quantities.
eg.
box1: Orange +5, Apple +3
box2: Apple +5, Orange +3
box3: automatically filled with remaining items. (+5, +3)
box4: automatically filled with remaining items. (+5, +3)
box5: automatically filled with remaining items. (+5, +3)
Container: automatically filled with remaining items. (+7, +7)
Special Container1: automatically filled with remaining items. (+12)
Special Container2: automatically filled with remaining items. (+9)
tldr:
I want to allocate 5 item types, each with a quantity of 15, to boxes/ containers of different storage capacities. This will be a calculator of sorts.
I’m not asking to be spoon fed code, i would like to solve the problem on my own(mostly).
I’m more interested in what specific areas of javascript i should focus my studies on to solve the problem. Also can anyone tell me how complex this problem is?
I’m sorry about the lengthy post and i do appreciate any assistance rendered in this thread.