Well, you could always assign each one a weight and if the total was more than the maximum weight, it wouldn't let you add it.
This might be trickier, but I think it's not that much harder.
...
Type: Posts; User: javapenguin
Well, you could always assign each one a weight and if the total was more than the maximum weight, it wouldn't let you add it.
This might be trickier, but I think it's not that much harder.
...
Value as in how many slots it takes up,or value as in price?
Assuming that each item has a slot, or location. Well, the user would need to know the location, but they can.
public void addAtSlot(int index, DataType item)
{
if (index < 0 || index >=...
for check inventory
public boolean checkInventory(DataType item)
if (aList.contains(item))
return true;
else return false;
Arrays or ArrayLists might work.
Arrays if there is a maximum size.
Adding/removing items needs an ArrayList.
You just need to make sure the user can't add beyond a certain range.
...