CS 401 Intermediate Programming Using Java
Project 3


Info

Posted:Wednesday, July 12th, 2006
Due Date:Friday, July 28th, 2006
Late Due Date:Monday, July 31st, 2006

Idea

You want to give the customers of your online store an easier and more interactive experience. You decide to design and implement a Graphical User Interface to replace the text and command line based interface your customers have been using thus far.


Assignment

Write a Java event driven application for your online store from project 2. Your application must do the following:

  1. Read the same input file from project 2 having the same format, which is reprinted below for convenience.
  2. Display a window with a well designed graphical user interface for the online store.
  3. For each inventory item in the store, the GUI must display:
    1. the product name
    2. The price of the product
    3. a JTextField in which the user will enter the quantity he or she would like to purchase
    4. a subtotal for each item as a JLabel which displays the price times the entered quantity minus a discount
    5. a JButton that, when clicked, displays a popup window describing a discount for the item, if there is one
  4. Around the collection of inventory items displayed should be a border with a title
  5. Displays information for the overall transaction, which includes:
    1. an overall subtotal that is updated with each change in item quantities
    2. the amount of the discount for the entire transaction (if there is no discount, this should not be displayed)
    3. the amount of any tax that is added to the sale. We'll assume that all users live in PA.
    4. A final total for the transaction
    5. (The tax and total should not be updated until the user checks out)
  6. Displays a Checkout button that, when clicked, prevents the user from changing the item quantities, calculates and displays the transaction discount, tax, and final total, enables the credit card field, and disables itself.
  7. Displays a JTextField to allow the user to enter his credit card number. For each customer, this should be initially disabled until the user clicks the checkout button. When the user enters his credit card number and hits the enter key, it should become disabled and the next customer button should become active.
  8. Displays a Next Customer button that's initially disabled. Once the user completes the transaction by entering his credit card number, this button should become enabled. When clicked, it should clear the transaction from the screen setting the subtotals back to zero, enabling the quantity fields and checkout button again, and disabling itself
  9. Displays a Quit Button that is always enabled and allows the user to terminate the application as an alternative to clicking the close box on the window.
  10. If the user enters a quantity greater than the available quantity in the inventory, a dialog box indicating the problem should appear, and the quantity entered should be reduced to the number of available items.
  11.  If any of the items have no units left in inventory, the corresponding JTextField should be permanently disabled.

Details

  1. The input file name should be a command line argument again as in the last project.
  2. The same discount and inventory item assumptions apply from project 2.
Input File Format

The input file that your program reads must have the following format:

Example Input File for products from first lab:

#-----------------------------------------------------------------
# CS401 Project 2 Example Input File
#
#-----------------------------------------------------------------

#Four products
4

#We have 300 Sunglasses at $50 with no discount
Sunglasses@300@50.00@0@

#DVDs have a type 2 discount of buy 5 or more, get $5 off per item
Matrix DVD@400@20.00@2@5@%5.00@

#
# Ignore comment lines and any empty lines
#
Neo Overcoat@10@250.00@0@

#
# Hover pads have a type 1 discount of buy 3, get 1 free
#
Hover Pad@20@4000000.00@1@3@1@

#
# Lastly, we have a type 3 discount of 10% if the purchase exceeds $500
#
3@500.00@0.1@

Notes and Hints


Extra Credit

For those interested in extra credit, you can implement some of the following and, as always, if you have another idea, first clear it with me: