Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) Ask the user for the capacity first, then keep getting the items until their total exceeds the capacity. Output the final total, without exceeding

1) Ask the user for the capacity first, then keep getting the items until their total exceeds the capacity. Output the final total, without exceeding the capacity. Enter capacity: 10 Input items: 3 5 1 4 Total: 9

2) After outputting the total, accommodate the final item in the next package and keep going! Infinite loop is OK. Enter capacity: 10 Input items: 3 5 1 4 Total: 9 3 5 Total: 7 ...

3) After outputting the total, accommodate the final item in the next package and keep going! Infinite loop is OK. Loop read item IF it can be accommodated add to total ELSE output current total init total with this item Enter capacity: 10 Input items: 3 5 1 4 Total: 9 3 5 Total: 7 ...

4) Each item weights 1 or 2 or 3 lbs. Capacity of each box is 3 lbs. Given # of items in each weight, determine minimum # of boxes needed. (1, 1, 1) (1, 2, 3) (3, 2, 1) (3, 1, 2) (5, 10, 15) (16, 10, 5) (10, 5, 15)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel 2024 In 7 Days

Authors: Alan Dinkins

1st Edition

B0CJ3X98XK, 979-8861224000

More Books

Students also viewed these Databases questions