Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Homework Help/Study Tips Expert

Tasks

1. Download the provided zip file, extract it to your workspace, add the project to the workspace, and look at the contents.

2. In particular, consider the file clothing.txt which contains a set of records representing items of clothing that are for sale by a retail outlet.

The file's contents follow a specific format: The first line of the file is an int value, specifying how many records will follow in the file after that line. Each of the records consists of 3 separate lines. The first line of three for each record is the description of the clothing item, the second line is the price of the item, and the third line represents a quantity that is in stock at the shop.

The clothing items can be represented in the program by objects of the ClothingItem class type, which has been provided to you. Ensure that you understand how to use the ClothingItem class.

3. Start to write a RetailShop class that includes the features described below. Remember that you will probably need to include some exception handling code. As you come to each task, you might want to update a separate Driver class (see task 4) to make sure it calls the method, and tests that the method is working correctly:

a. The constructor of RetailShop should create an ArrayList in which details of all the items of clothing will be stored. Initially (at constructor time) there should be no items. Ensure that the driver class creates an object of the RetailShop type, which will be used for calling the subsequent methods.

b. The loadFileDataCleanly( ) method should replace any contents that are in the ArrayList, with ClothingItem objects created from data which is read in from the clothing.txt file. Ensure that your driver class calls this method before any of the remaining methods or described behaviour is done.

c. The showItems( ) method should display each of the ClothingItems that the shop sells, reporting all details about each, including the quantity currently in stock.

d. The reportOutOfStock( ) method should display the same information as for showItems( ) except that the output should be written to a text file named report.txt, and it should only include those ClothingItems for which the quantity has reached 0.

e. The addNewItem( ) method should accept a ClothingItem object reference as the parameter, and if it has a valid value it will store this item at the end of the ArrayList after the existing items.

f. The saveItemsBinary( ) method should save the current state of all items that are in the ArrayList (including any that have been added by task e), to a binary file named items.dat, using techniques for serialization. If you need to alter any of the provided code to achieve this task, that is fine.

g. The loadItemsBinary( ) method should restore the state of the ArrayList to be referring to the same objects that it had at the time the data was serialized. So for example, if the first item was "Summer Dress with Flower patterns" and there was a quantity of 4 of them at serialization time, then after this method is called, the system would report that there are just 4 "Summer Dress with Flower Patterns" in stock. The only items that should be in the ArrayList, are the ones that were previously serialized.

4. Commence writing a text-menu-based driver class that starts by creating a new RetailShop object, and then address the following aspects. Note that it may require you to make further adjustments to the RetailShop class:

a. Initially, the RetailShop object should fill itself with data about items of clothing read in from file. It should aim to read the data from the binary file, but if that is missing it should try to load the initial data cleanly from the text file. If it can't read even from that text file, it should tell the user how to fix the problem, and exit.

b. One of the actions on the menu should call the showItems( ) method to show on the screen details about all the items of clothing normally sold.

c. Another of the actions on the menu should call the reportOutOfStock( ) method, to produce the text file containing the report of sold-out things.

d. Another of the actions on the menu should be to Exit the program. If this is selected, the program should save the current data about clothing items to a binary file, so that next time the program is started, that data can be restored from the binary file and the program can continue on as though it had never ended.

e. Another of the actions on the menu should be to "Sell an item of clothing". This should first present the user with a list of all the clothing items that are sold by the shop, and then ask the user to select one. If there is at least one of the selected item in stock, then the program should display a message indicating success and reduce the quantity in-stock by one - otherwise, report a suitable message to the user.

f. Another of the actions on the menu should allow the user to alter the price of any existing item of clothing. It should first present the user with a list of all the clothing items that are sold by the shop, and then ask the user to select one. Then it should ask the user to specify the new price, and make relevant changes to the system to ensure that the new price is thereafter used for the selected clothing item.

g. Another of the actions on the menu should allow the user to specify the details of a new item of clothing that the shop will sell, and record the information in memory. Thereafter, that new clothing item will be included in reports, lists, etc., including on future runs that load data from the binary file.

Homework Help/Study Tips, Others

  • Category:- Homework Help/Study Tips
  • Reference No.:- M91401621
  • Price:- $127

Guranteed 48 Hours Delivery, In Price:- $127

Have any Question?


Related Questions in Homework Help/Study Tips

Assignmenttruth is the key to making good and well-informed

Assignment Truth is the key to making good and well-informed decisions in management. However, criminal justice organizations in some jurisdictions do not practice the ethics of truth. They do not create trust in their a ...

Discussion-raew analysisthere are a variety of tools

Discussion-RAEW Analysis There are a variety of tools available for organizations to use to assess process. In this assignment you will learn how to apply a tool to a process situation. RAEW is an acronym for responsibil ...

This week you will use what youve learned to create a

This week, you will use what you've learned to create a summative assessment for the unit plan you created using one of the strategies from your PLC blog, and with the classroom environment you've outlined in Week Two.   ...

Assignment instructions sources need to be less than five

Assignment Instructions: Sources need to be less than five years old and journal/scholarly articles. Use only articles that are published between 2013-2018 (except for your theory articles which will be older as you must ...

Question choose a topic below related to the role of gender

Question: Choose a topic below related to the role of gender in history. You can choose particular women or divide the periods or tribes up to write this. Write a 350 word essay that discusses the role of women in histor ...

Task descriptionthis is an individual written assessment to

Task Description This is an individual, written assessment, to be completed in report format. You are required to write around 3,000 words (+/- 10%), excluding title page, preliminaries, tables, figures, reference list a ...

Question synthesizing and writingwhen looking for

Question: Synthesizing and Writing When looking for information about a particular issue, how often do you try to resist biases toward your own point of view? This assignment asks you to engage in this aspect of critical ...

Question using the information presented above please

Question: Using the information presented above, please answer the following two questions: Which group (Health Service Provision PhD Degrees, Health Service Provision PsyD Degrees or Non-Health Service Provision Degrees ...

Question write a 7 page paper 5 pages of content 1 title

Question: Write a 7 page paper (5 pages of content, 1 title page, 1 reference page) in APA format (including at least 2 scholarly references) on the following: Discuss the mass media impacts that are related to your chos ...

The process of assessment should always be viewed as the

The process of assessment should always be viewed as the first step in a potential intervention process. -McCann & Yarbrough, "Snapshots: Incorporating Comprehensive Developmental Screening Into Programs and Services for ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As