Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 10-18-2004, 09:06 PM   #1 (permalink)
kickerman97
Registered User
 
Join Date: Oct 2004
Posts: 9
kickerman97 is on a distinguished road
someone please help

ok im having trouble with an assignment its already late so i just need to finish it for the next assignment(they all interlink) I dont even know where to begin so if someone can give me a little help i would be very appreciative


This assignment will add functionality to your retail application from the first assignment. The data will be stored “in memory”. In other words, when you close down the application, all the customers, products, and orders that were entered will no longer exist. In future assignments you will be working with physical data storage.


Functionality Required
1. Customer entry – the user can enter a new customer, which is saved in memory. You need to give some indication that the record was saved (e.g. a popup message) and the data entry fields need to be cleared.
2. Customer list - the user can view a list of all customers and their information as was added on the Customer entry screen.
3. Product entry – the user can enter a new product, which is saved in memory. You need to give some indication that the record was saved (e.g. a popup message) and the data entry fields need to be cleared.
4. Product list – - the user can view a list of all products and their information as was added on the Product entry screen.
Order entry – the user can enter a new order, which is saved in memory. The user must be able to select a customer and a product from an available list (combo box). The user must be able to enter in the quantity ordered. You only need to allow for an order to consist of one product. You need to give some indication that the record was saved (e.g. a popup message) and the data entry fields need to be cleared.
Extra Credit (5 points): Before the order is saved, display the total amount of the sale. You must provide an option not to save the order after providing the total.
5. Sales report – the user can view a list of all orders placed including a total for each individual order, and a total for all orders.

This assignment builds on the previous assignment you completed. You can change your user interface as needed, but no drastic changes should be required.


Additional Requirements
In keeping with the concepts we have discussed in class, the following requirements also apply.

1. You will need to create objects that represent Customer, Product, and Order. Each object should have appropriate mutators and accessors (getters and setters) as well as an appropriate toString().

2. You will need to create three interfaces used to define the saving and retrieval of each of the object types: Customers, Products, and Orders.

3. You will need to create the classes or a single class that implement the interfaces created in Step 3.

4. You will need to create a factory class that returns the interfaces.

5. You will need to create a customized TableModel class for each of the display screens (a CustomerTableModel, ProductTableModel, and SalesOrderTableModel).

6. You will need to use ListComboBoxModel (given to you, not in the Java API) to hold Customers and Products for use in the JComboBoxes for the New Order screen.
Example:
List customerList = customerService.getCustomers();
ListComboBoxModel customersModel = new ListComboBoxModel(customerList);
customersComboBox = new JComboBox(customersModel);

7. Follow the coding conventions outlined in the slides from week 1.

8. If you have not already, enable the “About” menu item to be a popup (JOptionPane makes this easy).


What is NOT Required
You do not need to handle user errors. For example, the user enters letters instead of numbers for the price of the Product. For this assignment we will assume we have smart, mistake free users (an assumption you can't make in the real world : )


Recommended Steps to Complete the Assignment
I suggest you start with completing steps 1 and 2. Then start with Customers (new customer and customer display), go through the rest of the steps, repeat for Products, and then repeat again for Orders. This will allow you to get one piece at a time working instead of trying to get it all working at once. We will be covering much of this in class.

1. First create objects for Customer, Product, and Order. These objects should be able to hold any data that the user enters on the screen. When creating the Order object you should use composition (attributes of the Order class) to include a Customer and a Product. The Order object should have a method that returns the total amount of the order. Since the Product object will be an attribute of the Order class, you can easily get the price of the product.
2. Next create the interfaces needed for retrieving and saving a Customer, Product, and Order. An example of the Customer interface is in the last slide of the class slides from September 20th.
3. You can create an implementation class for each of the interfaces in step 2 or you can create one implementing class that implements all three interfaces. The implementation class or classes will hold a Java collection (ArrayList) for each of the object types. The collection objects will serve as our “in memory” persistence. Since the data is being held in memory, the collection objects should be "static". This way there is only one of each collection for the duration of the program being run.
4. Create a factory class that has methods that return each of the interfaces you created in Step 2. Inside the methods you will actually be returning newly instantiated implementation classes you created in Step 3.
5. This step only applies to the New Order screen. When constructing the New Order Panel you will need to load the customer combo box and products combo box by
i. Getting the appropriate interface from Step 2 via the factory class created in Step 4.
ii. Call the interface method that retrieves all the customers or products.
iii. Construct a new ListComboBoxModel instance for the customer or product combo box.
iv. Instantiate the customer and products combo boxes with their respective models.
6. Have each of the "new" panels (e.g. New Customer) implement ActionListener (assuming you have a button that fires the event to save the new record). In the actionPerformed() method
a. Get the values from the user's input and create an appropriate object (e.g. in the New Customer panel you will be creating a Customer object from the user's input).
b. Then get the appropriate interface from Step 2 via the factory class created in Step 4.
c. Use the method of the interface that adds the object.
d. Clear the screen and popup a message indicating that the new record was added.
7. Now that the records are being added, we can work on viewing them.
a. Create table models for customers, products, and orders by extending AbstractTableModel. The constructor should take a java.util.List (of customers, products, or orders).
b. When constructing the display panels you will need to
i. Get the appropriate interface from Step 2 via the factory class created in Step 4.
ii. Call the interface method that retrieves all the customers, products, or orders
iii. Construct a new table model instance for the customer, product, or order
iv. Instantiate the JTable with the appropriate model
8. Take a break!
kickerman97 is offline   Reply With Quote
Old 10-18-2004, 11:26 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,470
sde is on a distinguished road
i dont' know where to begin either. it's a lot easier to answer specific questions .. and people will probably be happier to help if you do a little more than copy & paste the homework assignment. let us know what the status is, .. or if you're stuck in a peticular place. good luck
__________________
Mike
sde is online now   Reply With Quote
Old 10-19-2004, 01:07 PM   #3 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,148
Belisarius is on a distinguished road
The recommended steps section is actually just about what I would suggest.

"1. First create objects for Customer, Product, and Order."

Have you tried doing this yet?
__________________
GitS
Belisarius is offline   Reply With Quote
Old 10-19-2004, 03:19 PM   #4 (permalink)
kickerman97
Registered User
 
Join Date: Oct 2004
Posts: 9
kickerman97 is on a distinguished road
i was actually posting it for someone else. I will let him know. Thanks
kickerman97 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 10:53 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting