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

JSP, can you provide some assignments for JSP learning

can you provide some assignments for JSP learning

C++, A charitable organization wants to design a special ATM machine to be ...

A charitable organization wants to design a special ATM machine to be used by needy people. The association supplies the needy person with a pin number to be able to use the ATM

Scramble word game, The aims of this assignment are to:    Provide e...

The aims of this assignment are to:    Provide experience in the use of a modern Integrated Development Environment (specifically NetBeans running on a Linux platform) for t

Cookies management with perl, One of the main strengths of the Perl program...

One of the main strengths of the Perl programming language are its powerful text manipulation features. In this assignment, you will put them to  use for writing a Perl program tha

Program on car purchasing simulation, Introduction A new online syst...

Introduction A new online system for purchasing carsis being designed and you have been contracted to write a C# console application program that models the proposed functio

Find the cookies expiring, Your program can be invoked with option: -d date...

Your program can be invoked with option: -d date, where date is entered in dd/mm/yyyy format. In this case, it must only print the following string: Found cookies expiring bef

Create calculate total project code uml models, Consider a system that has ...

Consider a system that has the following UML models: Use Case for CalculateTotalProjectCost Trigger: End of each month Normal Flow of Events For each project in the pro

Design program that presents animation of the solar system, Figure is a rep...

Figure is a representation of the solar system. In a basic model of the same concentric orbits planets rotate around the sun. The closer the Planet in less time Sun completes a ful

Develop an application for airraid game, Extend the AirRaid game, so that t...

Extend the AirRaid game, so that the planes drop a bomb on the gun as they go over it. The gun has to move out of the way otherwise it will be destroyed if hit. Provide three lives

Microprocessor, what is a microprocessor? types of microprocessors? advanta...

what is a microprocessor? types of microprocessors? advantages disadvantages

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