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...
-
Saturated water vapor at 200 kPa is in a constant pressure piston cylinder. At this state the piston is 0.1 m from the cylinder bottom. How much is this distance if the temperature is changed to a)...
-
Passara Supply Corp. has the following selected transactions for notes receivable. Nov. 1 Loaned $48,000 cash to A. Bouchard on a one-year, 8% note. Dec. 1 Sold goods to Wright, Inc., receiving a...
-
Note that to first \(\operatorname{order} N(d)=\frac{1}{2}+d / \sqrt{2 \pi}\). Use this to derive the value of a call option when the stock price is at the present value of the strike price; that is,...
-
A disk with radius R has uniform surface charge density (a) By regarding the disk as a series of thin concentric rings, calculate the electric potential V at a point on the disk's axis a distance x...
-
At greater than the critical angle: Part of the light reflects back into the n medium, the remainder travels along the boundary between the two mediums. The light is absorbed by the surface of the...
-
Cecil C. Seymour is a 64-year-old widower. He had income for 2022 as follows: The cost of the annuity was $46,800, and Cecil was expected to receive a total of 260 monthly payments of $450. Cecil has...
-
The following information deals with considerations regarding a new product. If the product in question is to be manufactured, it will be necessary to build a new production line, which will require...
-
A compensated tax return preparer has prepared a substantial portion of a client's filed tax return. If the preparer has discovered an omission in the return, the preparer must notify the client...
-
Various high symmetry points of the Brillouin zone are marked. the first Brillouin zone of a simple cubic lattice. In the empty lattice approximation the energy band structure ( k relation) is given...
-
The use of Multitenancy in an application is a solution that allows a Cloud Provider to use economies of scale to provide services to multiple users. One of the key requirements for a multitenancy...
-
1. A multiple-effect evaporator is to be used for evaporating 200,000 kg of water per day from salt solution. The total initial cost for the first effect is $18,000, and each additional effect costs...
-
The state exam for a Florida Broker has 1 0 0 questions where 4 5 % are on: Principals, Practices, & Law Brokerage Business Closing Transactions Management of a Real Estate Office
-
Find the determinant of the matrix A= 1-2 3 1 0 0 2 0 3 4 0 -1 2 3 2
-
What does non-recourse financing mean?
-
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
-
How do you use functional requirements for this chapter?
-
How does deployment pattern help understand the core of the problem?
-
How do you apply nonfunctional requirements for this chapter?
Study smarter with the SolutionInn App