# morrisville

posted by .

Problem 3: Baggage
Name your source code file Bags.py.
You will write a program that simulates the actions of luggage handling for a large aircraft.
As bags arrive they are loaded into containers. Each bag has a different weight and each container can hold a maximum amount of weight. When a container has reached its maximum weight capacity, or the next bag in the line will cause it to exceed its weight capacity, or there is no more bags, the container is sent to be loaded into the aircraft.
At the aircraft loading station, containers are unloaded such that the last container which arrives will be the first to be unloaded. The bags in each container are unloaded in the same order as they were loaded, i.e., last on, last off.
Write a program that prompts the user for a filename and the maximum container weight. The file will contain a list of bag weights in the order that the bags arrive. Your program should output to the screen the weights of the bags in the order they are unloaded. Two sample data files, bags25.dat and bags100.dat, are provided for you to test your program.
For example, here are the contents of the file bags25.dat:
16 24 25 3 20 18 7 17 4 15 13 22 2 12 10 5 8 1 11 21 19 6 23 9 14

• ???????? -

If you really want the help of an expert in this subject, you'll follow directions and put the SUBJECT in the School Subject box.

## Similar Questions

1. ### programming

Write a C program to sort the bags by weight. Assume that the input is given in a file. Each line of the input file corresponds to one polythene bag. For example a line in the file as below 10,20,20,10,10,50,10,50 corresponds to a …
2. ### math2

If you have a line plot with a bag of nuts(in pounds) and there is 1/8 on the graph with 8 x marks on of it bags, 1/4 with 4 x on top of it bags, and 1/2 with 4 x marks on top of it bags. The question goes as follow, Amy filled bags …
3. ### statistics

M&M’s The candy company claims that 10% of the M&M’s it produces are green. Suppose the candies are packed at random into small bags containing about 25 M&M’s per bag. A class of elementary students learning about percentages …
4. ### statistics

M&M’s The candy company claims that 10% of the M&M’s it produces are green. Suppose the candies are packed at random into small bags containing about 25 M&M’s per bag. A class of elementary students learning about percentages …
5. ### Chemistry

Okay so in our class we did an ice cream lab where we use Ziploc bags to make ice cream. We made an ice cream mixture and then put it into a smaller Ziploc bag. Then we got a large Ziploc bag and placed ice in it and placed the bag …
6. ### Mathematics

A 25kg bags of sugar is to be repack into a smaller bags of 250g of weight.How many such bags are needed?
7. ### Programming

using c++ write a program that accepts the unit weight of a bag of coffee in pounds and the number of bags sold and display the number of bags sold ,the weight per bag price per pound sales tax and total price of the sale.the unit …
8. ### Science

The mass of a baggage loaded truck and the mass of one bag are given . Now what will be the number of bags?
9. ### math

florence bought two bags of flour, A and B. the two bags contained different amounts of flour. the total mass was 108 kg. Gary poured 1/4 of the flour from bag A to bag B. After that, he poured 2/5 flour from bag B to bag A. he found …
10. ### Statistics

The weight of bags of pretzels are normally distributed with a mean of 150 grams and a standard deviation of 5 grams. Bags in the upper 4.5% are too heavy and must be repackaged. Also, the bags in the lower 5% do not meet the minimum …

More Similar Questions