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

Assignment Help:

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


Related Discussions:- Write a program that should read input from a text file

Java source code classes and objects, Design and implement a stringed music...

Design and implement a stringed musical instrument class using the following guidelines: a. Data fields for your instrument should include number of strings, an array of stri

Design and implement schemasusing xml schema, You are to build a Schema in ...

You are to build a Schema in XML Schema Language that will be used to support the development of the new central course information management system and other supporting applicati

String data transfer instruction in assembly language, What are the string ...

What are the string data transfer instruction in assembly language? Explain all types of string data transfer instructions with examples of each? What will be the behavior of direc

Define the control statements in computer programming, Define the Control s...

Define the Control statements in Computer Programming? The statements are part of the program that performs some action. The compiler will check a program sequentially from the

Design a address book, Consider the operation of a line of supermarket chec...

Consider the operation of a line of supermarket checkouts and the profiles of customers and their shopping baskets. Use a random number generator to create the data for these profi

To print total no.of ordinary files, Normal 0 false false f...

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

Program for nuclear reactor - embedded systems, Implement the "Nuclear Reac...

Implement the "Nuclear Reactor" example using the following:  An ISR triggered by a button press  A task to update the temperatures  A semaphore to communicate between the ISR and

Program which prints odd or even according to user input, Note: You should ...

Note: You should pay attention on following good practices: Appropriate code comments(If you make any assumptions clearly comment them in the code) Indentation

Compare 2 strings, Normal 0 false false false EN-US X...

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

Write Your Message!

Captcha
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