Question
Exercise 4: A supermarket needs to keep track of the daily sold items and the daily profit. 1. Use the Item class you created in
Exercise 4: A supermarket needs to keep track of the daily sold items and the daily profit.
1. Use the Item class you created in Lab 3
2. Create the following GUI to manipulate the class Item:
1. Read the available items from the input file with its name specified by the user.
2. When you read one item information, create an Item object, and use its toString() method to add it to the Text area.
3. Add new item using the Add button. Collect information from the text fields, then create an Item object, and use its toString() method to add it to the text Area.
4. Display the profit (or loss) attribute for the current added item.
5. Display the Total profit (or loss) for all items in the text area.
6. Save the new item list to an output file with its name specified by the user.
7. Implement the Clear button to clear all text fields.
8. Make sure to handle the exceptions if any might occur.
File Not Found Exception
Input Mismatch Exception
Number Format Exception
Array Index Out Of Bounds Exception
Arithmetic Exception
Null Pointer Exception
9. Provide a sample test file in your project. You should always test your classes before you submit. Test all possible cases (the file is not there, the file has unexpected data, The file is empty, The user enters incorrect values e.g. a string in the place of the price, etc.).
Design Preview [ItemFrame] -- Item Number ABC2211 Purchace Price 100 Add No. Items Sold 20 Selling Price 150 Clear Profit 0.0 Input File ItemInventory.txt Read Total Profit -1000.0 Output File Items.out Write ABC1234 20 35.5 40.5 XYZ5434 30 200 230 WQE 767 250 100 90 TRY1290 100 25 30 Status OK Design Preview [ItemFrame] -- Item Number ABC2211 Purchace Price 100 Add No. Items Sold 20 Selling Price 150 Clear Profit 0.0 Input File ItemInventory.txt Read Total Profit -1000.0 Output File Items.out Write ABC1234 20 35.5 40.5 XYZ5434 30 200 230 WQE 767 250 100 90 TRY1290 100 25 30 Status OKStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started