Adjustments to the retailshop class

Assignment Help Other Subject
Reference no: EM13831767

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.

Reference no: EM13831767

Questions Cloud

Describes current stage of self-regulatory ability : Which stage do you think best describes your current stage of self-regulatory ability. Why did you choose this stage. Give three concrete examples to support your choice.
What was the behavioral or health problem of concern : What was the behavioral or health problem of concern. What were the interventions that were being contrasted in the study
Should we leave consumption of health care to the market : Should we leave consumption of health care to the market? Why? Policy is not merely a technical exercise. Explain your response with reference to the policy triangle using the HPV case study.
Salary and benefit packages of comparable organizations : Compare and contrast salary and benefit packages of at least three comparable organizations in the same industry. Examine what 21st-century employees consider to be benefits (see this week's recommended readings for a start)
Adjustments to the retailshop class : 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 rem..
Database system awareness : Databases are used by nearly every operating business. They may not all be relational but data are stored, recorded, analyzed, etc. in order for any successful business to run.
What is the direction of the resultant displacement : What is the direction of the resultant displacement
At what speed does the vehicle move along descent path : At what speed does the vehicle move along its descent path
Critical thinking exercises : Peter owns and operates Pete's Perfectly Organic Bakery, a small local bakery in a small town in California.  He uses wheat and other organically grown ingredients in his bakery goods and grows much of the wheat and other ingredients on his adjace..

Reviews

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd