Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

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

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M9533603

Have any Question?


Related Questions in Programming Language

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

Background informationthis assignment tests your

Background Information This assignment tests your understanding of and ability to apply the programming concepts we have covered throughout the unit. The concepts covered in the second half of the unit build upon the fun ...

Task arrays and structsoverviewin this task you will

Task: Arrays and Structs Overview In this task you will continue to work on the knight database to help Camelot keep track of all of their knights. We can now add a kingdom struct to help work with and manage all of the ...

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As