Create a program that receives the list of possible named items with the following information: o...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create a program that receives the list of possible named items with the following information: o Value ($), Height (in), Width (in), Depth (in) 1. The limit of the optimal solution is expressed by the volume in cubic inches (in³) and the program has to maximize the value within the cubic limit 2. Your program should read a textual file with one item type per line with the information separated by comma, for example this file lists four items with values 35, 40, 45, and 58 dollars and increasing dimensions 3. Your program should capture the overall limit of the package/knapsack from the user. 4. Your program should read any file with this format (name, value, height, width, depth) per line 5. Your program must print out the best distribution with a string like: "The suggested items are: 72 Milky Ways and 5 Tootsie Rolls with a total value of $53. There were 4 square inches left unused." 6. The printed statement must at least include: names of items included; number of items included; total profit; leftover space. 1 2 3 4 small medium large jumbo A B 35 40 45 58 3 4 5 (O) 6 4 5 6 6 E 2 4 5 6 Create a program that receives the list of possible named items with the following information: o Value ($), Height (in), Width (in), Depth (in) 1. The limit of the optimal solution is expressed by the volume in cubic inches (in³) and the program has to maximize the value within the cubic limit 2. Your program should read a textual file with one item type per line with the information separated by comma, for example this file lists four items with values 35, 40, 45, and 58 dollars and increasing dimensions 3. Your program should capture the overall limit of the package/knapsack from the user. 4. Your program should read any file with this format (name, value, height, width, depth) per line 5. Your program must print out the best distribution with a string like: "The suggested items are: 72 Milky Ways and 5 Tootsie Rolls with a total value of $53. There were 4 square inches left unused." 6. The printed statement must at least include: names of items included; number of items included; total profit; leftover space. 1 2 3 4 small medium large jumbo A B 35 40 45 58 3 4 5 (O) 6 4 5 6 6 E 2 4 5 6
Expert Answer:
Answer rating: 100% (QA)
To solve the knapsack problem with the given requirements you can use dynamic programming Heres a Py... View the full answer
Related Book For
Microsoft Visual C# An Introduction to Object-Oriented Programming
ISBN: 978-1337102100
7th edition
Authors: Joyce Farrell
Posted Date:
Students also viewed these programming questions
-
An invoice was received for $6200 dated June 21 with terms 2/10, n/30. (a) What is the last day for taking the cash discount? (b) What is the amount due if the invoice is paid on the last day for...
-
Using the Playfair matrix to encode the message: "successfully" assuming that the keyword is "CATERPILLAR". Show the matrix and your work. Highlight your answer.
-
In this assignment, you will create a program that allows theuser to draw in a window using brushes of different sizes andcolors. The user will be able to change the size and color of thebrush using...
-
Dwights preferences over beer and whiskey satisfy more is better, but are concave (thus violating the usual assumption of convexity). a. On a diagram, sketch what such indifference curves would look...
-
Rob Stevens is the chief executive officer of Isner Construction, Inc., and owns 850,000 shares of stock. The company currently has 5.1 million shares of stock and convertible bonds with a face value...
-
Can NPV and IRR lead to different conclusions about a projects financial attractiveness?
-
On January 1 of each of the first four years of its existence, Allway Company purchases a new unit of equipment. Each unit has a four-year life and zero salvage value, costs \(\$ 100,000\), and is...
-
At the beginning of 2016, the Redd Company had the following balances in its accounts: Cash ........ $ 6,900 Inventory ....... 15,000 Land ......... 7,000 Common stock .... 15,000 Retained earnings...
-
A significant participation activity can bedefined as:Any trade or business activity in which a taxpayer materiallyparticipates.Any rental real estate activity in which the taxpayer has bonafide 0...
-
It is now January 2018. The year 2017 finished well. The finalized year-end financial statements for 2017 are provided in the excel file associated with this assignment. Randolf and Tenisa at Comfy...
-
The VRIO Framework is an analysis tool designed to identify and protect the competencies that provides long term competitive advantage. The framework lays four questions in order to evaluate a firm's...
-
Find the 70th percentile. A customer service representative must spend different amounts of time with each customer to resolve various concerns. The amount of time spent with each customer can be...
-
Miller Retailing, Inc., maintains a staff of three full-time internal auditors who report directly to the controller. In planning to use the internal auditors to help in performing the audit, the...
-
Discuss the format of a report on condensed financial statements. What type of assurance is provided?
-
Define a special report according to AU Section 623.
-
Regardless of the assessed level of control risk, an auditor would perform some a. Tests of controls to determine the effectiveness of internal controls. b. Analytical procedures to verify the design...
-
. During an interview, the potential employer of goods regulated by OGD asked you to explain the importance of SWI and Participating Government Agency (PGA) to his company. Explain in Paragraph. with...
-
An educational researcher devised a wooden toy assembly project to test learning in 6-year-olds. The time in seconds to assemble the project was noted, and the toy was disassembled out of the childs...
-
Use the code shown in Figure 6-33 to answer What will the code in Figure 6-33 display when the id variable contains the character 7? a. Janet b. Jerry c. Mark d. Sue if (id -- '8') cout
-
Use the sales array to answer. The array was declared using the int sales[5] = {10000, 12000, 900, 500, 20000}; statement. Which of the following if clauses verifies that the array subscript stored...
-
Use the code shown in Figure 6-33 to answer What will the code in Figure 6-33 display when the id variable contains the character 9? a. Janet b. Jerry c. Mark d. Sue if (id -- '8') cout
-
A companys balance sheet appears as follows: Required: (a) If 10,000 of the ordinary shares were purchased at par, there being no new issue of shares for the purpose, show the journal entries to...
-
Some years ago M plc had issued 375,000 of 10 per cent debentures 2006/2010 at par. The terms of the issue allow the company the right to repurchase these debentures for cancellation at or below par,...
-
Debentures of 30,000 are issued on 1 January 2003. Redemption is to take place, on equal terms, four years later. The company decides to put aside an equal amount to be invested at 5 per cent which...
Study smarter with the SolutionInn App