Partial Solution and Comments for Assignment 1
Overall, Assignment 1 was quite well done. The average was a B. Documentation
was well presented, and almost all implementations worked satisfactorily. Testing
was reasonably comprehensive, and the test plans I saw were clear. Where several
groups made mistakes was with design, as the following comments suggest.
Solution Hints
There were many acceptable solutions to Assignment 1. The best solutions
had classes roughly like the following:
- CUSTOMER: the ADT of customers. Customers have all the information
mentioned in the assignment: names, emails, credit cards, etc. They also have
passwords.
- PRODUCT: most groups chose to implement a specific type of product,
and thus had a BOOK or VIDEO class. That's the best way to go
for this assignment. For assignment 2, I'd create a (deferred) PRODUCT class and
inherit from it with specific subtypes (e.g., BOOK, VIDEO).
- CUSTOMER_DATABASE: an array/list/tree of customers. The customer database
knows how to load and save customers into a file, and provides search facilities.
- PRODUCT_DATABASE: an array/list/tree of products (e.g., BOOKs). The product
database knows how to load and save the product database, and provides search facilities.
It also has an attribute for storing the last product that has been found by a search.
- MONSTRO_MART: the root class. It provides login features, the user interface
(which could be just a simple menu) and keeps track of the last 5 purchases made by
the current customer (this info. could be saved in a file after the customer logged out).
Another design option here would be to have the customer themselves keep track of their
last five purchases. There doesn't appear to be any criteria for deciding between one
or the other option here.
No further classes are really needed to solve the problem. A PASSWORD class is a
possibility, but it is not required.
No inheritance is necessary in this solution. Class MONSTRO_MART will have a
customer database, a product database, a customer (the current customer logged in),
and numerous user interface features.
Common Problems
A number of reoccuring problems appeared in many solutions.