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

Title: Program #1 Page 1 Title: “Program Assignment 1: Event-Driven Programming” Points: 100 points Due Date: Sunday September 12, 2021 by 11:59 pm (WebCourses time) Objectives: 1. To refresh your...

1 answer below »
Title: Program #1
Page 1


Title: “Program Assignment 1: Event-Driven Programming”
Points: 100 points
Due Date: Sunday September 12, 2021 by 11:59 pm (WebCourses time)
Objectives:
1. To refresh your basic Java skills.
2. To practice event-driven programming using Java-based GUIs.
3. 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 appends 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, 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 – Fall 2021
Assignment title: Project 1 – Event-driven Enterprise Simulation
Date: Sunday September 12, 2021
*
Input Specification: The file “inventory.txt” as described above (see example below as
well).

1 Source = https:
www.wonderslist.com/top-10-largest-rivers/
CNT 4714 – Project 1 – Fall 2021
Page 2
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.
Deliverables:
(1) Submit a working copy of your source code (all .java files), including your
inventory.txt file and your transaction.txt file, via WebCourses no later than
11:59pm Sunday September 12, 2021.
(2) Include a file that contains screen shots, similar to those illustrated below, that shows your
application in action as a user interacts with your e-store to purchase items. Provide
screenshots that show each step in a “normal successful” purchasing session with multiple
products as well as some of the typical e
or conditions (e.g., product not in stock, and
product not found.)
(3) Include a screen shot of your “transactions.txt” file showing at least the last few
transactions (similar to the one shown on the last page of this document). There should be a
minimum of five different transactions represented in the transaction file.
(4) You can zip all of the above into a single folder.

Additional Information:
Shown below are example screen shots of the GUI to help illustrate how your application is to operate.
Page 3
1. Screen shot of the contents of an example “inventory.txt” file.


Page 4
2. Initial GUI:

3. GUI after user specifies total number of items in the order and makes a selection for item #1, but
efore clicking the “Process Item” button.


Allows for
processing an
item once it is
selected.
Confirms that
the item is
co
ect.
View the
order so far.
Completes
an order –
generates
invoice and
adds to the
transaction
file.
Clears order
and starts over
- no write to
transaction
file
Quit!
Note that the
“Confirm Item”,
“View order”,
and “Finish
Order” buttons
are not initially
“active”.
Page 5
4. GUI after user has selected the first item and clicked the “Process Item #1” button.


5. When the user clicks on the “Confirm Item #1” button, a confirmation information message
appears on the screen.

Note that the “Confirm
Item #1” button is now
active and the “Process
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.
User entered an inco
ect
item ID. This message
would be displayed when
user pressed the Process
Item button. This is the
only “e
or” you will need
to catch.
Page 6
6. The main GUI after the user has confirmed the first item.

7. User enters and processes (but has not yet confirmed) the next item in the order (which is 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 a item. If:
1-4 = 0%
5-9 = 10%
10-14 = 15%
=15 = 20%
Note that
the buttons
change
number.
Page 7
8. The GUI after the user has entered the information for all the items and confirmed the last item.

9. When the user clicks the “View Order” button, the following message box should appear.
Page 8
10. When the user clicks the “Finish Order” button, the invoice message should be 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 9
11. The transaction file after order shown above was finished. Note the unique transaction ids based
on the date and time.

12. If the user enters an item number for an item that is not in stock, the following message will
appear. The user must then enter a new item number for an in-stock item to continue processing
the cu
ent transaction.

Page 10

13. 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 seven separate
transactions.
Note that after the not in
stock e
or, the GUI has
lanked the ID and quantity
fields for the user.

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 1/20", false, 75.00
14909, "1/4in - 28tpi SS nuts", true, 1.00
2190, "Hefty 30 gal with handles - box 40", true, 19.00
XXXXXXXXXX, "3 ft mini USB cable M-F", true, 4.50
678944, "EZ-ink cartrige set for Epson 4630", false, 75.00
234887, "2021 CSX train calendar", true, 12.95
198, "Box of 10 Sharpie Roller 0.5mm", true, 6.50
298765, "3x5 index cards - 100 count", true, 2.25
7654, "Bell Stratos helmet - size Lg - blue", false, 230.00
XXXXXXXXXX, "12x16 paper cutter with ruler", true, 35.95
8543, "Ritchey 1 inch threaded headset - silver", true, 45.00
XXXXXXXXXX, "Wilson NCAA official softball - 1 ea", true, 5.50
2234983, "Wilson NCAA official softball - 1 doz", true, 55.00
23, "Tamiya 2oz paint - fe
ari red", true, 2.39
97634, "Campagnolo 12 spd crankset - 53/39 175mm", true, 750.00
85456, "Campagnolo 12 spd rear der", true, 350.00
67913, "Gios Torino t-shirt size XXL", true, 25.00
387, "Brachs butterscotch hard candy - 1 lb", true, 4.50
113355, "The Bourne Identity - blu-ray", true, 15.95
1111, "Top Secret Twenty One - Janet Evanovich", true, 8.99
286934, "1 lb - coffee beans", true, 6.50
358922, "25 lbs peanuts in shell", false, 45.00
47831, "8x10 picture frame", true, 4.95
19981, "Pledge furniture polish 13oz", true, 6.50
228865, "3M Super 33+ electrical tape", true, 3.50
228865X, "3M Super 33+ electrical tape box 10", true, 32.50
4762, "HP copy paper ultra white - ream", true, 13.50
29741, "Plush teddy bear 8 inch", true, 24.00
339921, "Yamaha KT 100 kart engine", true, 950.00
115693, "Colnago C64 - Mapei frame", true, XXXXXXXXXX
582913, "Look Keo 2 Max pedals", true, 135.00
4499120, "M&Ms dark chocolate w/peanuts - 3oz", true, 2.50
268, "Sidi Wire 2 ca
on shoes", true, 499.99
89476, "Assos T-Evo shorts", true, 299.95
245667, "Colnago jersey - size 6", true, 120.00
Answered Same Day Sep 11, 2021

Solution

Ramachandran answered on Sep 12 2021
157 Votes
Order-90976/instruction-notes-for-student.docx
Instructions for student
1. Please fill the personal details on top of all the files
2. The solution is in the solution folder, import or copy the files in the editor of your choice
3. The solution screen shot which is to be submitted is also attached in the zip.
4. The input file “inventory.txt” is placed in the resources folder in the solution
5. The ouput file “transactions.txt” is generated at the root of the solutions folde
The Program uses JDK 8 along with SWING and AWT to build java GUI application
To run the application run the Main.java
References
SWING layout - https:
www.javatpoint.com/java-gridbaglayout
SWING dialogs - https:
docs.oracle.com/javase/tutorial/uiswing/components/dialog.html
File reading - https:
mkyong.com/java8/java-8-stream-read-a-file-line-by-line
File writing - https:
www.geeksforgeeks.org/java-program-to-append-a-string-in-an-existing-file/
Order-90976/Solution
esources/inventory.txt
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 1/20", false, 75.00
14909, "1/4in - 28tpi SS nuts", true, 1.00
2190, "Hefty 30 gal with handles - box 40", true, 19.00
22345532, "3 ft mini USB cable M-F", true, 4.50
678944, "EZ-ink cartrige set for Epson 4630", false, 75.00
234887, "2021 CSX train calendar", true, 12.95
198, "Box of 10 Sharpie Roller 0.5mm", true, 6.50
298765, "3x5 index cards - 100 count", true, 2.25
7654, "Bell Stratos helmet - size Lg - blue", false, 230.00
65435689, "12x16 paper cutter with ruler", true, 35.95
8543, "Ritchey 1 inch threaded headset - silver", true, 45.00
38712987, "Wilson NCAA official softball - 1 ea", true, 5.50
2234983, "Wilson NCAA official softball - 1 doz", true, 55.00
23, "Tamiya 2oz paint - fe
ari red", true, 2.39
97634, "Campagnolo 12 spd crankset - 53/39 175mm", true, 750.00
85456, "Campagnolo 12 spd rear der", true, 350.00
67913, "Gios Torino t-shirt size XXL", true, 25.00
387, "Brachs butterscotch hard candy - 1 lb", true, 4.50
113355, "The Bourne Identity - blu-ray", true, 15.95
1111, "Top Secret Twenty One - Janet Evanovich", true, 8.99
286934, "1 lb - coffee beans", true, 6.50
358922, "25 lbs peanuts in shell", false, 45.00
47831, "8x10 picture frame", true, 4.95
19981, "Pledge furniture polish 13oz", true, 6.50
228865, "3M Super 33+ electrical tape", true, 3.50
228865X, "3M Super 33+ electrical tape box 10", true, 32.50
4762, "HP copy paper ultra white - ream", true, 13.50
29741, "Plush teddy bear 8 inch", true, 24.00
339921, "Yamaha KT 100 kart engine", true, 950.00
115693, "Colnago C64 - Mapei frame", true, 6500.00
582913, "Look Keo 2 Max pedals", true, 135.00
4499120, "M&Ms dark chocolate w/peanuts - 3oz", true, 2.50
268, "Sidi Wire 2 ca
on shoes", true, 499.99
89476, "Assos T-Evo shorts", true, 299.95
245667, "Colnago jersey - size 6", true,...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here