Homework 9

Due Tuesday September 6, 5:30pm

Optional


Homework 9 is optional. If submitted, the grade will be used to replace your lowest homework grade (if the grade on this homework is higher -- therefore doing this assignment can't hurt your grade).

Homework 9 should be submitted electronically, by sending it to me in an e-mail - with all files 'zip'ed or 'tar'ed into one file.  This file should be named hw-9-YOURNAME.[tar|zip] (i.e. extension should be either tar or zip). It should expand into a directory of the same name, minus the extension.
 Submissions that do not follow these instructions will not be graded.

  1. Select one of the following classes from previous assignments:
    Each of these classes depend on other classes.
    1. Where necessary, create a graphical design for your chosen class. (If one exists from the solution set, use the provided design).
    2. Modify the design to include information about appropriate access to the various fields and methods (i.e. public, private, etc.) Note: All methods in an interface must be public.
    3. Modify the code for these classes to reflect the changes in design. 
    Save each class as it's own file. The student class should be named Student.java, and other classes should follow a similar pattern.
  2. Using your answer to #1, add a main method to the class mentioned above. When run, the main method should present the results of the tests. If there are not tests available (as is the case for EnglishSpanishDictionary, devise appropriate tests to display).
  3. Consider the following scenario:
    A book store wants to expand to have an on-line presence

    They want established customers to be able to purchase books on-line.

    An established customer will provide the book store with a username and password.
    The bookstore also knows the credit card number of all established customers.

    When accessing the bookstore on line, any user can inquire whether the bookstore has a certain book.
    The bookstore will search on title, title and author, or isbn number.

    An established customer can purchase a book by providing the bookstore with the book (the result of the search(s) described above), their username and password.

    If the customer does not provide a valid username and a valid password for that user, the customer will be informed of failure in purchasing the book.

    Once the book is purchased, the bookstore must remove that book from it's holdings of stocked books.
    You have been hired to design a set of classes for the bookstore.
    Your design should include any necessary access controls for the fields and methods.
    Hint: You may want at least a Bookstore, Book and Customer design.
  4. Take your design from #3, and provide a Java implementation for all of the classes. Do not worry about the methods your design outlined. You should have one file per class.
  5. Now, choose two or three methods from your design in #3 and implement them in your classes from #4.
  6. Again using your implementation from #4, add a toString method to all of your classes that displays your data in a clear style. Add a main method that will display examples of the data when the program is run. You may also display the outcome of tests if you desire.