Program 2

General Policies:

Do NOT share code. You will not receive help on the day a program is due or after the due date, SO DO NOT PROCRASTINATE!!!

Program 2 counts for 11% of your grade.


William Shatner is the Priceline Negotiator. In this assignment, you will build a program supporting a basic store. Only 5 items will be sold. Your program will support two roles: a shopper in the store, and the owner of the store. A shopper will be able to begin shopping, add a given number of items to their shopping cart, remove items from their shopping cart, display the items in their shopping cart, ask about prices for items, and check out. An owner will be able to adjust prices for items (by percentage or by dollar amount), learn the average amount per sale at the store, learn the average percentage change for items in the store, and discontinue and revive store items.

Write a StoreItem class. Please include fields for the name of the item, the initial inventory of the item, the current inventory of the item, the tentative quantity sold of the item, the initial price of the item, the current price of the item, the percentage below which new inventory can be ordered (trigger percentage), a flag indicating whether the item is currently available for purchase, the number of times that the price of the item has been changed, and the total for all price percentage changes of the item. Also, there should be defaults set for the initial inventory, default price, and default trigger percentage. These should be shared among all StoreItem objects created.

Write a Store class that stores 5 store items (HAS-A relationship). The constructor then calls a private method to instantiate the five items. Simply hard code the information for the items in this private method. In addition,

Write a ShopperOwnerDriver class to manage the store. Instantiate a Store object (this should be a static instance variable in the driver) with your name as the seller (ex. Jane Smith). Include enough menu options to allow all shopper and owner roles to be performed. Write a private static helper method for each of the options. Make sure to check user input. I will try to break your program.

Format all prices with the DecimalFormat class. Use commas as separators in your format where appropriate.

Program Specification:

Program Documentation:
Follow the documentation guidelines.

Electronic Submission: All files needed to run your program!
Comment and Print Out: