Homework 1 (Shopping) FAQ

Q: If the GUI seems to work, is that enough to know I'll get a 100%? Is the GUI exhaustive?
A: No, it isn't exhaustive. Use your ShopTest.java to test other cases.
Q: Can we assume that all Items will have unique names?
A: The spec is silent on this issue, so the behavior is unspecified. In general, you shouldn't assume things that are not stated in the spec, but for example, getItem(name) in Catalog would be affected if you had two items with the same name, so this is basically an (intentional) hole in the spec. We won't test on that case.
Q: Is the bulk price passed to DiscountedItem's constructor the discounted price for an individual item or the total price for all the items in the discount group?
A: It is the total price for all the items in the bulk discount group, NOT the price for an individual item in the discount group.
Q: Does the hasDiscount method of ShoppingCart take into account the total quantity being >= 20, or is it just echoing back the boolean passed to setDiscount earlier?
A: The latter. The result returned by hasDiscount is unrelated to the number of items in the cart.
Q: Is it okay to use $(DATA_STRUCTURE) to implement the $(CLASS)?
A: So long as you meet the behavioral and performance constraints in the spec, any structure(s) are allowed.
Q: Why am I getting a ConcurrentModificationException?
A: You are probably modifying a collection while you are iterating or for-each-looping over it. You can't do that, except if you perform the modification through an Iterator over the collection.
Q: Is the getDiscountPercentage method in ShoppingCart supposed to return an integer? Or can we have a discount of 3.52% ?
A: An integer.
Q: For the mycatalog.txt, do you expect us to come up with different Items, or just the same ones you have but with different prices?
A: Make up your own new items.
Q: My DiscountedItem constructor won't compile.
A: See the lecture slides about inheritance, constructors, and super.
Q: Will this solution get full points? Is this the style you want?
A: That is an inappropriate question. We call this "pre-grading." The TA won't look over your entire program for mistakes or tell you exactly what things you will get marked off for. We'll grade you on the guidelines in the homework document, and we can help you with specific issues but cannot evaluate your entire program.