Question

In: Computer Science

A central distributes lime to different branch warehouses. They have a loading dock where sacks of...

A central distributes lime to different branch warehouses. They have a loading dock where sacks of lime of between 3000 and 9000 kg are arriving, with variable weights depending on the production circumstances. The company has a fleet of trucks with load capacities of between 18,000 and 28,000 Kgs.

It is intended to establish a protocol consisting of loading 20 trucks a day. Each truck wants to load a maximum of its capacity limit, having to leave if the next pull in the production line would exceed its capacity.

The company wants to develop a program that asks the operator in charge of loading the capacity of the truck and the weight of the bags, indicating whether to load the bag or dispatch the truck to start loading another.

Need help to make the code with python

Solutions

Expert Solution

choice = 'yes'
while(choice == 'yes'):
    capacity = int(input('Enter the capacity of the truck (18000 kg 28000 kg): '))
    if not(18000<=capacity<=28000):
        print("Invalid truck capacity.")
        break;
    capacityLeft = capacity
    while(True):
        weight = int(input('Enter weight of bag (3000 kg to 9000 kg): '))
        if capacityLeft-weight>=0:
            capacityLeft -= weight
        else:
            break
    print("Truck with capacity:", capacity, "loaded with", capacity-capacityLeft, "kg lime, dispatched.")
    choice = input("Do you want to load next truck? yes/no")


Related Solutions

True or False? David and Nate work for two different companies, but each performs the same job working on a loading dock.
True or False?1. David and Nate work for two different companies, but each performs the same job working on a loading dock. David, however, earns a higher salary than his friend Nate The difference in salary could illustrate union wages if David’s annual salary is covered by a collective bargaining agreement and Nate’s is not.2. Critics argue that a disadvantage of the Earned Income Tax Credit is that it does not effectively target the working poor because many recipients are...
XYZ holdings have many branches. Each branch has a name and is located in a different...
XYZ holdings have many branches. Each branch has a name and is located in a different province. Each branch has several departments such as marketing, finance, sales and customer relations. For a department to exist there must be employees employed in each of the departments. An employee is ether a permanent staff member or a temporary staff member. The difference between these two types of employees exist in the facts that permanent staff earns a fixed salary of R30 000...
XYZ holdings have many branches. Each branch has a name and is located in a different...
XYZ holdings have many branches. Each branch has a name and is located in a different province. Each branch has several departments such as marketing, finance, sales and customer relations. For a department to exist there must be employees employed in each of the departments. An employee is ether a permanent staff member or a temporary staff member. The difference between these two types of employees exist in the facts that permanent staff earns a fixed salary of R30 000...
Two countries have the same currency and central bank but their bond yields are different, what...
Two countries have the same currency and central bank but their bond yields are different, what is the cause of this?
1. Discuss the different measures of central tendency that have been used during the pandemic with...
1. Discuss the different measures of central tendency that have been used during the pandemic with Examples. 2. What is the Distinguish between classical, empirical, and subjective probability and give examples of each.
1. Discuss the different measures of central tendency that have been used during the pandemic with...
1. Discuss the different measures of central tendency that have been used during the pandemic with Examples. 2. What is the Distinguish between classical, empirical, and subjective probability and give examples of each.
A central question in biology is, how do we have > 200 different cell types, complete...
A central question in biology is, how do we have > 200 different cell types, complete with unique cell morphologies and functions, when all cells have the same DNA (the concept of genomic equivalence). Epigenetic regulation of gene transcription is one way to explain this. Define what is meant by epigenetic regulation of gene transcription, including different general epigenetic mechanisms, and describe three different contexts of a developmental process that is associated with epigenetic changes that we have discussed in...
We have several Measures of Central Tendency (averages). We usually use the mean. Where would we...
We have several Measures of Central Tendency (averages). We usually use the mean. Where would we use other measures, such as the mode or the median?
You have colleagues who reside in different zip codes. Which measure(s) of central tendency or other...
You have colleagues who reside in different zip codes. Which measure(s) of central tendency or other descriptive statistics would you use to describe this information? (please answer in full paragraphs - thank you)
Central Tendency & Descriptive Statistics: You have colleagues who reside in different zip codes. Which measure(s)...
Central Tendency & Descriptive Statistics: You have colleagues who reside in different zip codes. Which measure(s) of central tendency (mean, median, mode) or other descriptive statistics would you use to describe this information? (please answer in full paragraph - thank you)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT