CSCE 155

Homework Assignment 4: 

GUI Design in OO Fashion --- A Grocery Store

Assigned:  October 15, 2004

Due: Start of Class, October 27, 2004

 

Note: This assignment is to be completed individually - collaboration is strictly prohibited.

Points:  100 points

 

Problem Description

 

In this assignment, you are required to design a GUI application using multiple classes. You will implement a simple Grocery Store. The interface for this assignment should allow the user to enter a customer’s name and his or her purchases in the store. For example, your program should record such information:

 

customer “Kim” purchases

1 unit of milk and 2 units of bagels on June 1, 2004

2 units of bread and 3 units of eggs on June 6, 2004

 

Your program needs to display the history of a customer’s purchases and compute the monthly total purchase amount.

 

You should design the system in an object-oriented fashion using multiple classes, each with well-defined functionalities that interact with the others to accomplish the requirements. The GUI application should perform the following tasks:

 

 

 

Figure 1

 

 

Figure 2

 

 

Figure 3

 

 

 

Figure 4

The system should contain five classes:

 

1.   GroceryStore: This class stores the merchandises and customers information. It includes an array (or a vector) of merchandises and an array (or a vector) of customers.  This class starts your application by displaying the welcome window to the user, and initializes all other classes.  Consider that the store has an unlimited supply of all its merchandises.  This is a GUI application class.

2.   Merchandise: This class has an item’s name, its unit price.   

3.   Customer:  This class has a customer’s name, an array of Purchase objects.

4.   Purchase:  This class has a purchase’s date, an array of Merchandise objects (as purchased items) and an array of integers, each integer recording the number of units purchased for a particular merchandise.

5.   PurchaseReport:  This class display the history of the purchase a custom made or compute the monthly total purchase.  This is a GUI application class.

 

In implementing GroceryStore class, the application should read the information of the merchandises from a file, called “MerchandiseInfo.txt”, which is in the following format:

 

Milk 3.34

Bagel 1.99

Bread 0.99

Icecream 2.50

Eggs 1.10

 

You can create your own item list, but remember to include at least 5 items.  You may assume that our test input file only has 1000 items.

 

Supplied Solution Components

 

None.

 

Submission Procedure

 

This assignment is due on October 27, 2004 at the start of class. Your grade will be reduced by 10% for each day it is late. It is recommended you read the grading policy and grading guidelines on the course website for a complete explanation of how the assignments will be graded. Remember, your program should follow good programming style, include plenty of comments, and perform all of the functionality outlined above.

After completing the assignment, you must “handin” the following files on-line:

1.      Source files: GroceryStore.java, Merchandise.java, Customer.java, Purchase.java, PurchaseReport.java and others

2.      Compiled files:  All the *.class files

3.      Readme file: README.TXT

4.      Data file: MerchandiseInfo.txt

In addition, you must submit a stapled paper copy of your source code (and README file), please write down your CSE email on your paper copy.  Both of these steps must be done by the start of class on the day the assignment is due.