Java Community | Help. Code. Learn.JC|HCL
Java Community | Help. Code. Learn.โ€ข11mo agoโ€ข
3 replies
lunds_

Warehouse exercise for CS class

Question: Suppose the following code executes given a Warehouse class following the specification from the assignment. What would be printed out?

If my understanding is correct I have a max of 42 and I can only take 37 given my warehouse (w)

then I receive 86 new items of 46's but since my warehouse can only take 37 I take 37 and now since my max is 42 I'm left over with 5

then for the last line of code is printing out how much I have left over of how many available items I can take its gonna be 82 - 5 which is 77

the answer would be 77. Would love to get any clarification or where I went wrong.
Coding_excercise.PNG
Was this page helpful?