This may be skipping around the rules, but what about inner classes? They are still technically part of the class...
Interesting project... Maybe I'll try it and see if I can come up with snippets if you need them.
You seem to be doing okay... at least you are trying. Unless you think inner classes are allowed, you will need parallel arrays or Maps of some sort. Parallel arrays are ugly, but they shouldn't be too bad in this case, as you know what the size will be already (numSlots)
|
Quote:
|
public class restockProduct(String product, int quantity)
{
if (quantity <= maxperslot)
{System.out.println("This is the " + quantity);}
}
|
This one is breaking the rules... you are not allowed to use IO, and you can't return class... It doesn't exist, and returning Class would be pointless. You probably want the method to return a boolean indicating whether the restock was successful. The setProduct method has the same problem with it's return type.
My final point (promise!): The constructor should set the values of the classes fields. I think the code is from your teacher, but it needs to be changed
Good Luck,
Singing Boyo
__________________
If the above doesn't make sense to you, ignore it, but remember it - might be useful!
And if you just randomly taught yourself to program, well... you're just like me!