Write a program that should read input from a text file, Programming Languages

A hardware store sells the following hardware tools: screwdriver, wrench, and tape measure. You are asked to calculate the profit for the store based on the number of tools sold and their sale price as follows: profit of a screwdriver is 5% of the sale price; profit of a  wrench is 8%, and profit of a tape measure is 10%.

You need to follow the following interfaces:

interfaceIPart {

doubleget_Price();

voidset_Price(double price);

intget_SaleAmount();

voidset_SaleAmount(int amount);

doublegetProfit();

}

interfaceIStore {

ArrayListgetParts();

voidaddPart(IPart part);

doublegetTotalProfit();

}

Your classes implementing the above two interfaces should NOT have any other public methods except a toString() method.

Your program should read input from a text file, add the indicated parts to the store, print out the sale information for each part, and then print out the store's total profit.See the example input and output below.

The first line of input will be the number of parts. Each line after that will contain a single part - consisting of the type of part, the sale price, and the amount sold. The data is separated by commas.

Example input:

7

Wrench,10.97,200

Wrench,20.22,600

Screwdriver,8.99,150

Screwdriver,12.55,550

Screwdriver,12.55,20

TapeMeasure,3.99,150

TapeMeasure,6.99,230

Example output:

200 wrenches at $10.97

600 wrenches at $20.22

150 screwdrivers at $8.99

550 screwdrivers at $12.55

20 screwdrivers at $12.55

150 tape measures at $3.99

230 tape measures at $6.99

Total Profit is $1791.80

Posted Date: 3/30/2013 7:30:04 AM | Location : United States







Related Discussions:- Write a program that should read input from a text file, Assignment Help, Ask Question on Write a program that should read input from a text file, Get Answer, Expert's Help, Write a program that should read input from a text file Discussions

Write discussion on Write a program that should read input from a text file
Your posts are moderated
Related Questions
I am working on a game project using C# XNA. I only have two weeks from the deadline. Would you help me to finish it up? Please let me know as soon as possible. Thanks, Sophi

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

How to read datasets in multiple text files in an non interactive program?

Develop a socket program in UNIX/Linux that uses (i) TCP as the transport protocol and  (ii) UDP as the transport protocol for transferring  a short message between a client and  s

Write a python script that will take two file names as input (src, dest). Open src reading each line in the file, and replacing any occurrences of name with the string "redacted".

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

A large offshore accommodation barge is to be converted into a floating luxury hotel.  It will be connected to a single point mooring buoy (SPM) in a beautiful inland loch where th

Write three functions, statistics, average, and sD as follows. The statistics function returns no value and has six parameters: four scores followed by their average and standard d

i need help

Term project (you should code a function), demonstrate it to the class and a very breief report (one or two pages) describing what you did. You determine your project (could be imp