Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Microsoft Word - Project 1 - Spring 2023.docx Page 1 Title: “Program Assignment 1: Event-Driven Programming” Points: 100 points Due Date: Sunday January 29, 2023 by 11:59 pm...

2 answer below »
Microsoft Word - Project 1 - Spring 2023.docx
Page 1


Title: “Program Assignment 1: Event-Driven Programming”
Points: 100 points
Due Date: Sunday January 29, 2023 by 11:59 pm (WebCourses time)

Objectives: To practice event-driven programming using Java-based GUIs. To refresh your basic
Java skills. To simulate (albeit at a very high-level) an enterprise application.

Description: Develop a Java program that creates a standalone GUI application that simulates an e-
store (we’ll call our store Nile Dot Com… we’re not quite as big as Amazon.com!)1 which allows the
user to add in stock items to a shopping cart and once all items are included, total all costs (including
tax), produces an invoice, and append a transaction log file.

Your program development must include the following steps:
1. Create a main GUI containing the following components:
a. An area that allows the user to input data into the application along with the descriptive
text that describes each input area.
. A total of six buttons as shown below with functionality as described below.
c. As illustrated below, the various buttons on the interface are only accessible at certain
points during a user’s interaction with the e-store.
2. An input file named “inventory.txt”. This is a comma separated file which contains the
data that will be read by the application when the user makes a selection. Each line in this file
contains four entries: an item id (a string), a quoted string containing the description of the
item, an in stock status (a string), and the unit price for one of the item (a double). A sample
file is provided for you on WebCourses. Feel free to create your own input file for testing
purposes or augment the provided input file.
3. An output file (append only) named “transactions.txt” must be created that uniquely
logs each user transaction with the e-store. The unique transaction id will be generated as a
permutation of the date/time string when the transaction occu
ed (see below).

Restrictions:
Your source file shall begin with comments containing the following information:
* Name:
Course: CNT 4714 – Spring 2023
Assignment title: Project 1 – Event-driven Enterprise Simulation
Date: Sunday January 29, 2023
*/

Input Specification: The file “inventory.txt” as described above (see example below as
well).

Output Specification: Output is to appear in the specified components of the GUI and various
message boxes that appear, plus the contents of the
“transactions.txt” log file that will be generated.


1 Source = https:
www.wonderslist.com/top-10-largest-rivers/
CNT 4714 – Project 1 – Spring 2023
Page 2
Deliverables:
Submit the following via WebCourses no later than 11:59pm Sunday January 29, 2023.
You can zip everything into a single folder if you would like.
(1) A working copy of your source code (all .java files) and any necessary supporting li
aries.
(2) Include a file that contains (at least) the following nine screen shots.
a. The initial GUI (like number 2 in Additional Information below).
. The GUI after the user has entered an item number (ID) and quantity and clicked the
“Find Item #” button (like number 4 below).
c. The pop-up message box when the user has purchased the selected item (like number
7 below).
d. The pop-up message box when the user has entered an item number (ID) that was not
found in the inventory file (like number 6 below).
e. The GUI after the user has purchased the selected item (like number 8 below).
f. The GUI after the user has purchased an item and has entered another item and found
it, but not yet confirmed it (like number 9 below).
g. The message dialog box when the user clicks the “View Cu
ent Order” button with
multiple items in the order (like number 11 below).
h. The message dialog box when the user clicks the “Complete Order - Check Out”
utton for an order containing multiple items (like number 12 below).
i. The message dialog box when the user has entered an item number (ID) for an item
that is out of stock (like number s 5 and 14 below).
j. You may include more screenshots than the nine listed above if you think they will
illustrate additional features of your application than those already listed above.
(3) Include your “transactions.txt” file as it stands after several different transactions
have been recorded. You should have at least 5 different transactions in the file with at least
three of these transactions having four or more items in the transaction. (similar to the one
shown on the last page of this document).

Additional Information:



















Page 3

1. Screen shot of the contents of an example “inventory.txt” file.








Page 4
2. Initial GUI:






























Allows for finding
an item once it’s
information is
entered.
Purchase
item. Add to
cart.
View the
order so far.
“Complete
Order”
utton
completes
an order –
generates
invoice and
adds to the
transaction
file.
Clears order and starts over
- no write to transaction
file if items are in cart. If
checkout has already
occu
ed, then restart app.
Quit!
Note that the
“Purchase Item”,
“View Cu
ent
Order”, and
“Complete Order”
uttons are not
initially “active”.
User entry
areas
App returns
item info here
App calculates
unning subtotal
Page 5
3. GUI after user has entered first item number and the quantity of the item they want to purchase,
ut before clicking the “Find Item” button.




4. GUI after user has selected the first item and clicked the “Find Item #1” button.










Note that the “Purchase
Item #1” button is now
active and the “Find Item
#1” button is inactive.
Information on the item
selected/purchased has
een extracted from the
inventory file and written
into the window on the
line for item #1. Note
proper cu
ency
formatting.
Page 6
5. When the user clicks on the “Find Item #1” button and the item is found in the inventory,
ut the item is not in stock, then the following message would appear and the user is
prompted to enter another product id. (see below as well)



6. When the user clicks on the “Find Item #1” button, if the item is not found in the inventory,
then the following message would appear on the user’s screen.




7. When the user clicks the “Purchase Item #1” button, the following message would appear on
their screen.


User entered an item ID
that was not found in the
inventory file (DB). Item is
not processed and the user
will need to enter a new
item ID. Note that the item
number will not increment
in this case.
Pop-up message when the
item was found and in
stock in the inventory file
(DB).
Page 7

8. The main GUI after the user has purchased the first item.











9. User enters and finds (but has not yet purchased) the next item in the order (which we’ll
make the last one for this order).




Information
for previous
item remains
on display.
Subtotal should
eflect cu
ent
total of all
confirmed items.
Note that the text areas
for entering the second
item information are
cleared and ready for
input.

Discount is based on the
quantity of an item. If:
1-4 = 0%
5-9 = 10%
10-14 = 15%
=15 = 20%
Note that
the buttons
change
number.
Page 8
10. The GUI after the user has entered the information for all the items and purchased the last
item they wish to order.



11. When the user clicks the “View Cu
ent Order” button, the following message box should
appear.

















Page 9
12. When the user clicks the “Complete Order – Check Out” button, the invoice message should
e generated and displayed.

















The date and time are used
to create the unique
transaction id in the
“transactions.txt” file. For
the invoice the format is
“DD/MM/YY HH:MM:SS
TMZ”
Page 10
13. The transaction file after order shown above was finished. Note the unique transaction ids
ased on the date and time.









14. If the user enters an item number for an item that is not in stock (it is in the inventory – just
not in stock), the following message dialog should appear. Once the user clicks OK in the
dialog box, then they would enter a new item number for another item and continue processing
their cu
ent transaction. Notice below, that after clicking ok in the dialog box, the GUI is
eset to the original item number and the input fields are empty.






The transaction occu
ed on 01/11/2023 at
19:53 (7:53pm). See the invoice message
above. Permutation used here is:
DDMMYYYYHHMM.
Page 11






















Notice that after the “Not In Stock” e
or has
occu
ed, the GUI has cleared the user entries
in the two input fields and has not
incremented the item count.
Page 12
15. The GUI after the user has clicked the “Complete Order – Check Out” button and also clicked
“OK” on the invoice dialog box.






























Notice that ID and quantity fields are no
longer editable, since the order has been
completed. Thus a new order must be
started.(A little hard to see here, but the
fields are greyed out and not editable –
stands out more on a Windows OS.)
Page 13
16. The transaction file after several orders have been completed. Note the unique transaction ids
ased on the date and time for every separate transaction. This file shows eight separate
transactions.


14, "Stanley #2 Philips Screwdriver", true, 6.95
2342, "Polar USB mini desk fan", false, 10.50
22389, "Swingline Model B2200 stapler", true, 18.00
3451, "Oakley Jaw
eaker sunglasses", true, 236.00
4452, "Colnago stem - black 130mm", false, 145.99
56718, "Tamiya Mclaren MP4-8 Ford
Answered 3 days After Jan 16, 2023

Solution

Aditi answered on Jan 20 2023
36 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here