Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You have been asked to create a system to help organize a paint store on a computer. The system will be operated by the cashier.

You have been asked to create a system to help organize a paint store on a computer. The
system will be operated by the cashier.
The Paint Seller System will allow customers to buy home dcor paint from the store. To buy
paint it is first searched for in the store by the colour name and brand name, then the system
requests how many cans of this paint the customer wishes to buy, it will then calculate the cost
of the paint. Once all the different types of paint the customer is buying have been entered, the
system will calculate the final cost of all the paint, including the GST. A full receipt will then be
printed for the customer.
The cashier should also be able to add new types of paint to the system, by providing a
description. As well as edit and remove existing types of paint from the system. When the
system is turned off, all the paint descriptions are store in an inventory file which is imported
when the system turns back on.
The system will use two enumerated types (enums):
1. ColourCategory: this enum will define the major categories that colour names can be
sorted into. These will include: Red, Orange, Yellow, Green, Blue, Purple, Brown, White
2. PaintType: this enum will define the types of paint that are available. These will include:
Interior, Exterior, Spray, Rust, Floor, Stain
Each of the enums should be saved in its own Java file.
The system will use a Paint class to represent the different types of paint available at the store.
The Paint class will have the following instance fields:
colourName: the name of the paint colour. Ex. Winter Blue, Dusty Pink
brand: the brand name of the company who makes the paint
colourCategory: use the enum type described above
paintType: use the enum type described above
stock: how many can of the paint are currently in stock at the store
price: the unit price of a can of the paint
And the following instance methods:
a no-argument constructor
a constructor with six parameters (use the enum types for the appropriate parameters).
a copy constructor
an accessor method for each field (return the enum types for the appropriate fields).
a mutator method for each field (use the enum types for the appropriate parameters)
a toString method, which will be used to record the paint in the inventory file
an equals method, which will return true if the colourName and brand of the paints are
the same.
a compareTo method, which implements the Comparable interface. The method will
compare the paints based on their colourName. If paints have the same colour names,
the method will use the paints brand to determine the result.
buy(int amount): removes the amount from stock and returns the cost of the paint
based on the price
The Paint class will also have the following static field:
gstRate
And the following static methods:
getGSTRate()
setGSTRate(double gst)
The methods of the Paint class should throw an IllegalArgumentException whenever an
argument passed to a method is invalid or will cause a field value to be invalid (Ex. Negative
prices, stocks or amounts; buying an amount that is greater than the stock).
You will then implement the PaintStore application.
The application uses an array of Paint objects (not an ArrayList) to represent the store. Each of
the important features will be implemented as static methods. There are also methods which
will sort the Paint array and search the Paint array.
importInventory(): will import the paint descriptions from the file inventory.txt and add
them to the Paint array. The first line of the file contains the GST rate as a double value:
0.15
The remaining lines of the file contain the textbook descriptions in the following format:
name/brand/category/type/stock/price
The following is an example of one possible paint description:
Winter Blue/Rona/Blue/Interier/56/45.99
All paint descriptions should be added to the Paint array before displaying the
application menu. This method should close the application if the inventory.txt file is
not found.
addPaint(): adds a new paint description to the Paint array and then sorts the array
using the static method sort. The method will ask to user to enter the values used for
each field of the Paint object. Input validation should be performed to ensure each
value is valid (where applicable). For example, checking that the stock or price are not
negative. If the store is full, this method will throw an Exception (i.e. throw an exception
using the Exception class).
editPaint(): searches the Paint array for a paint using the binarySearch method, then
allows the user to edit the fields of the Paint object. The user should be able to choose
which field they wish to edit and can choose to edit another field of the same paint
without repeating the search. Remember to perform input validation on any values entered by the user instead of catching the exceptions

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

3. Identify cultural universals in nonverbal communication.

Answered: 1 week ago

Question

2. Discuss the types of messages that are communicated nonverbally.

Answered: 1 week ago