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
What is DOM? The Document Object Model is a platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure an

Introduction This assignment builds on your application, produced in Assignment 1, which holds a list of cabins, which can be either read in from a text file or just hard coded

Task: This assignment is about writing programmes and Web Services in C#: 1) Develop a console programme that reads a sequence of integer numbers from the console and sorts

Example : Find the general solution to the subsequent differential equation. x 2 y′′ - 7 xy′ + 16 y= 0   Solution First the roots of (3)  r (r -1) - 7r + 16= 0 r 2

Objective: The purpose of this programming project is to explore page replacement algorithms. This can be accomplished by developing a simple simulator that implements various pag

W.A.S.S to find the maximum of three numbers Program # W.A.S.S to find the maximum of three numbers echo "Enter three No.:" read no1 read no2 read no3 if test $no1 -gt $n

Write a program to mask bits D3D2D1D0 and to set bits D5D4 and to invert bits D7D6 of the AX register.

1- Allocate array with 32bit 100 element 2- Prompt the user to enter the maximum or the upper bound of the random value 3- Read the value and use it generate random numbers to init

write a program to draw a cow. Now, draw a cow standing amongst the grass, with (say) 500 blades of grass. Each blade of grass should be a separate random green line. Do all your d

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