Homework for the Holidays 2

You are going to write a class that will work with the Tool class and a file. It will read in a name, a quantity and then a price. It will then place that instance into the array. There are 15 tools in the file.

First, in BlueJ Create a new Project. Call in FileReaderProject2. Then open the Tool class text file Here. Create a new class in BlueJ call it Tool. Paste in information from the Tool text file. Compile it.

Next - open the data.txt file Here. Save it as toolsdata.txt into the same folder where your Tool class is.

Next - open the filereader.txt file Here. Copy it. Form a new class in BlueJ - call it filereader - then paste the info from filereader.txt into it and compile it. You should then be able to create an instance of the filereader Object and call the reader method. This method should fill an array with 15 copies of the Tool class. Look at the file reader program - try to see what is going on. It is very important that you have some clue as to what this file is doing.

Once that is done try to do the methods listed. Do one at a time. Comment out the others by putting // in front of it. They won't compile if they have to return something.

The only one that is hard is

public void changeAllPrices(double rate)

If the rate is positive all prices go up, if the rate is negative all prices go down.

For example - if the hammer price was 20 and the rate was .1 then the price would increase by 10% and become 22. All prices would change based upon their original cost. Check to see if your code works (you can do the math)