Monday
March 30, 2015

Homework Help: morrisville

Posted by ama on Thursday, February 14, 2013 at 7:33pm.

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

Answer this Question

First Name:
School Subject:
Answer:

Related Questions

Math 6th Grade Level - A baker bought 680,000 oz. of flour and packed the flour ...
Math - What do you call an angle more than 90 degrees and less than 180 degrees...
English - What do you use to do your shopping in England? Plastic bags, carrier ...
math2 - If you have a line plot with a bag of nuts(in pounds) and there is 1/8 ...
Math - Chad buys peanuts in 2-pound bags. He repackages them into bags that hold...
Math. - Ashanti and Maria went to the store to buy snacks for their back to ...
statistics - M&Mís The candy company claims that 10% of the M&Mís it produces ...
statistics - M&Mís The candy company claims that 10% of the M&Mís it produces ...
Programming - 2. Then it should prompt the user for the input file name of the ...
Math - David carried 29 pounds of kitty litter in bags into the basement. There ...

Members