** PLEASE DON'T ANSWER IF YOU ARE JUST GOING TO PASTE RANDOM
CODE AND NOT ANSWER THE QUESTION. I WILL DOWN VOTE! **
Create an app in JAVA that people can use to search all the
t-shirts in my store based on size, price range, and brand. As
you'll see from my inventory I stock a range of brands (my brand
range sometimes changes). My sizing is fixed though, with sizes
being XS - extra small, S - small, M - medium, L - large, XL -
extra large, 2XL, 3XL and 4XL.
I want users to be able to view all the t-shirts in my
inventory that meet their search criteria in the following
format:
Item name: Nerd
Caption: Graphic text: "Be a nerd or join the herd!" Classic fit white tee. Pair with blue jeans for a relaxed look.
Product code: 572938750
Brand: YodaTs
Price: $19.99
Users should be able to choose any one of them. If they want
to place an order, they must provide their full name, as well as
their phone number and/or email address. These details should be
written to a file, with the details of the t-shirt they wish to
order, in the following format:
Order details:
Name: Walter Shepman
Phone number: 0486756465
Item: Coding croc (255078775)
Size: XL
Create a simple class named Geek. It should
contain the following:
- Two fields or more fields, as specified by Greek Geek.
- A constructor that initialises the fields.
- Getters for each field.
Create an Enum named Size. It
should contain the following:
- A constant representing each available size.
- A method that returns an informative and visually
pleasing String representation of each
constant.
- At the top of Size, in a block comment, explain
why an Enum data type is the best way to
represent the size values
Create a class named TShirt. It should contain the
following:
- Fields to represent the name, product code, price, brand,
description and collection of available sizes of t-shirts.
HINT: use a Collection, e.g.
a Set or List to store
the Size constants
- Fields to be used for the user's search, i.e. min and max
price, as well as the user's chosen size.
- In a block comment above the fields identified in Step 2,
explain how allowing the user to search based on price range
(rather than price value) improves functionality.
- At least ONE constructor used to initialise fields.
HINT 1: TShirt objects can be
created in TWO ways 1) to represent a real t-shirt from the
inventory AND 2) to represent an 'imaginary' t-shirt that fits the
user's search criteria.
HINT 2: Setters can also be used to initialise
variables.
- Getters and setters as appropriate
- A method that describes the t-shirt in the format required by
the Greek Geek.
Create a class named Inventory. It should contain
the following:
- A field that stores a collection
of TShirt objects.
- A method to add a TShirt to the field.
- A method to find which t-shirts in the inventory match the
user's 'dream' t-shirt. This method should have
a TShirt parameter, and search the field
(collection of TShirt objects)
for TShirts that match the parameter. It should
return a collection of matching TShirts.
HINT: check if the brands match, then check
if the price falls within the user's desired price range, and
finally, check if the user's desired size is in
the TShirt object's collection of available
sizes.
- Create a class named TShirtSearcher. It should
contain the following:
- A method to load the data from
the inventory.txt file. This method
should have a String file path parameter, and
return an instance of the Inventory class.
HINT 1: After loading the file, loop through
its contents, parsing the data, using it to
create TShirt objects.
HINT 2: Use an instance of
the Inventory class to store all
the TShirt objects.
- A method to write the Geek user's order
information to a text file in the format specified by the Greek
Geek.
- The method should
have Geek, TShirt and Size parameters.
- The name of the file should be the geek's name, followed by the
t-shirt product code and t-shirt size, with no whitespaces,
e.g.;
Walter_Shepman_255078775_XL.txt.
- A main method, which:
- Uses the method described in Step 1.1 to create
an Inventory object.
- Requests user input for size, brand and price range, using this
data to initialise a TShirt object.
HINT 1: set irrelevant
parameters to null, 0 or
empty String as appropriate.
HINT 2: Use setters to
initialise TShirt properties not set during
object creation.
- The TShirt object representing the user's
filters should be used to search for a
real TShirt (stored in
the Inventory object) that matches the user's
preferences.
- The user should be presented with t-shirts that match their
criteria in the form of a drop-down list, allowing them to select
ONE t-shirt.
HINT 1: keep track of the mapping between
the T-Shirt name/product code shown in the
dropdown list, and the TShirt object itself by
using a Map
HINT 2: populate the dropdown list using
the Map keyset.
- The program should account for THREE situations:
- Matching items are found and user selects ONE.
- No matching items are found.
- The user closes the dialog.
- If the user selects a matching game, the user's info should be
requested and used to create a Geek object,
which should then be passed (along with the chosen t-shirt) into
the method described in Step 1.2.
- To achieve full marks, please ensure you handle all exceptions,
validate all user input and fully document your code.
HINT: Use Javadoc to document your code.
- To test if your program is fully functional, run it, and
select/enter the following:
Medium
Tommy Bugfinder
10
You should obtain the following output:

Select WASD from the dropdown list, then enter the
following:
Walter Shepman
04895867776 AND/OR
wshepman@geekmail.com
Your program should generate a file named
Walter_Shepman_624462664_M.txt. An example of its contents could
be:
Order details:
Name: Walter Shepman
Phone number: 04895867776
Item: WASD (624462664)
Size: Medium
The file inventory.txt has been provided. It
contains all the data you need to complete this task.
inventory.txt
name,product code,price,brand,sizes,description
hello world,852760540,34.96,Tommy Bugfinder,[S,M,L,XL,XXL],[Graphic text: "Hello world". Greet the world in true geek style with this eye-catching Java coding t-shirt!]
The Simpsons,576857394,22.99,Lacoder,[S,M,L],[Graphic text: "Worst. Episode. Ever." A T only for the true Simpsons fan!]
The Matrix - Kung fu,439847587,43.95,Master Tee,[XL,XXL,XXXL,XXXXL],[Graphic text: "I know kung fu.". Rock this T with a pair of dark glasses.]
Heisenberg,109302984,25.99,CodeBreaker,[M,L,XL],["Everyday wear for the Breaking Bad fan. Classic/traditional fit. Soft and durable."]
Nerd,572938750,19.99,YodaTs,[S,M,L,XL,XXL,XXXL],[Graphic text: "Be a nerd or join the herd!" Classic fit white tee. Pair with blue jeans for a relaxed look.]
More geeks,238153253,10.50,Lacoder,[XS,S,M,L,XL,XXL,XXXL,XXXXL],[Graphic text: "...the world needs more geeks."]
WASD,624462664,11.45,Tommy Bugfinder,[XS,S,M],[Graphic text: "WASD" Comfy, durable, baggy fit tee - makes a great gamer gift!]
Console,846747474,6.00,Tommy Bugfinder,[XS,S,M,L,XL],[Pair this t-shirt with your favourite jeans, sneakers and you're ready to go (or game).]
Level 21,205996406,55.00,YodaTs,[S,M,L,XL,XXL],[Graphic text: "Level 21 complete." The perfect birthday gift for the 21YO geek.]
Coding croc,225554325,12.99,Lacoder,[XS,S,M,L,XL],[The perfect tee to add to your geek wardrobe.]
Heisenberg danger,436434354,11.14,YodaTs,[XS,S,M,L,XL],[Graphic text: "I am not in danger. I am the danger". This super-soft, super-sized 100% cotton tee is the best outfit for bingeing Breaking Bad.]
Tiger,245363656,9.99,CodeBreaker,[XXL,XXXL,XXXXL],[Graphic text: "Face it tiger, you just hit the jackpot!" Slim fit, must have everyday tee.]
Laser Brain,485848332,69.99,Tommy Bugfinder,[M,XL,XXXL,XXXXL],[Graphic text: "I don’t know where you get your delusions laser brain." Essential Star Wars gear.]
Matches found!! The following t-shirts meet your criteria: Item name: hello world Caption: Graphic text: "Hello world". Greet the world in true geek style with this eye-catching Java coding t-shirt! Product code: 852760540 Brand: Tommy Bugfinder Price: \( \$ 34.96 \) Item name: WASD Caption: Graphic text: "WASD" Comfy, durable, baggy fit tee - makes a great gamer gift! Product code: 624462664 Brand: Tommy Bugfinder Price: \( \$ 11.45 \) Please select which t-shirt you'd like to order: