• Post Reply Bookmark Topic Watch Topic
  • New Topic

ArrayList Shopping cart  RSS feed

 
Nicky Larson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. The purchase method must have furniture AND quantity.
. Number of furniture should not exceed the quantity in stock.
. Add the number of furniture to the purchase ArrayList
. Delete the same number of the furniture from the inventory

I tried this but doesn't work:

 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Please UseCodeTags (← click) when posting code as it makes it easier for people to read your code. I've added them for you this time.

To get the quickest and best responses to a question you need to TellTheDetails (← click), ie does it fail to compile (if so post the compiler message), throw an exception when running (if so post the exception message and stack trace) or just not give the required output (if so tell us what you expected and what it actually did)?

From a quick look at your code I can see it won't compile because the ArrayList class doesn't have a quantityInStock field. Ask yourself if you think it is correct to be looking at the list of items to purchase for the quantity in stock or should this be a field in the Inventory class.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!