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

Review the website airmail service from the smithsonian

Review the website Airmail Service from the Smithsonian National Postal Museum that is dedicated to the history of the U.S. Air Mail Service. Go to the Airmail in America link and explore the additional tabs along the le ...

Read the article frank whittle and the race for the jet

Read the article Frank Whittle and the Race for the Jet from "Historynet" describing the historical influences of Sir Frank Whittle and his early work contributions to jet engine technologies. Prepare a presentation high ...

Overviewnow that we have had an introduction to the context

Overview Now that we have had an introduction to the context of Jesus' life and an overview of the Biblical gospels, we are now ready to take a look at the earliest gospel written about Jesus - the Gospel of Mark. In thi ...

Fitness projectstudents will design and implement a six

Fitness Project Students will design and implement a six week long fitness program for a family member, friend or co-worker. The fitness program will be based on concepts discussed in class. Students will provide justifi ...

Read grand canyon collision - the greatest commercial air

Read Grand Canyon Collision - The greatest commercial air tragedy of its day! from doney, which details the circumstances surrounding one of the most prolific aircraft accidents of all time-the June 1956 mid-air collisio ...

Qestion anti-trustprior to completing the assignment

Question: Anti-Trust Prior to completing the assignment, review Chapter 4 of your course text. You are a manager with 5 years of experience and need to write a report for senior management on how your firm can avoid the ...

Question how has the patient and affordable care act of

Question: How has the Patient and Affordable Care Act of 2010 (the "Health Care Reform Act") reshaped financial arrangements between hospitals, physicians, and other providers with Medicare making a single payment for al ...

Plate tectonicsthe learning objectives for chapter 2 and

Plate Tectonics The Learning Objectives for Chapter 2 and this web quest is to learn about and become familiar with: Plate Boundary Types Plate Boundary Interactions Plate Tectonic Map of the World Past Plate Movement an ...

Question critical case for billing amp codingcomplete the

Question: Critical Case for Billing & Coding Complete the Critical Case for Billing & Coding simulation within the LearnScape platform. You will need to create a single Microsoft Word file and save it to your computer. A ...

Review the cba provided in the resources section between

Review the CBA provided in the resources section between the Trustees of Columbia University and Local 2110 International Union of Technical, Office, and Professional Workers. Describe how this is similar to a "contract" ...

  • 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