Question: Part 2 : Air Cargo Logistics An airline is using airplanes of various sizes to ship containers between two airports. Each shipment consists of a
Part : Air Cargo Logistics
An airline is using airplanes of various sizes to ship containers between two airports. Each
shipment consists of a number of standardized containers that must be loaded on the airplanes so
as to minimize the amount of unused space. As several shipments of different sizes arrive at the
airport, the airline must decide which shipment is loaded on which plane. The following rules are
applied:
All airplanes are flying to the same destination, ie a shipment can be added to any
airplane.
A shipment cannot be split among different airplanes.
Once a shipment is loaded on a plane, it cannot be unloaded before departure.
You are tasked with writing a program that will assign shipments to airplanes in the order of the
shipments arrival at the airport. The airline you work for operates Airbus A planes with a
capacity of containers each, Boeing B airplanes with a capacity of containers each, and
Boeing B airplanes with a capacity of containers each.
Description
The input of the program consists of the size of the shipments ie number of containers in the
shipments in the order in which they appear in the queue. The assignment program must first
print a list of available slots in all empty airplanes. It should then read the size of each shipment
to be loaded and report on attempts to assign the shipment to an airplane. Finally, it should print
a summary of all assignments. See the example input and output files for details. If a shipment
size is not valid ie not a positive number of containers an exception should be thrown and an
error message printed before the program proceeds with the next shipment.
Assignment
The program assign.cpp is provided, together with the header files Airline.h and
Airplane.h You should not modify these files. You will implement the classes Airline
and Airplane in the files Airline.cpp and Airplane.cpp respectively. A Makefile
is provided and must not be modified. Use the test input files to verify that your program
reproduces exactly the example output files. Use the Unix diff command to compare your
output to the example output. Your classes must function correctly independently of the number
of each type of airplanes used by the airline. When computing the assignment grade, a modified
version of the program assign.cpp will be used, with different numbers of airplanes.
Copyright The Regents of the University of California
Specification of the Airline class
The Airline class constructor creates the list of airplanes using dynamic allocation of the
private pointer array airplaneList. The airplanes should appear in the list in order of
increasing size. The Airline constructor takes three arguments the number of A B
and B airplanes The nAirplanes data member is the total number of airplanes used by
the airline. The Airline class has a member function addShipment that tries to assign a
shipment to an airplane by inspecting the list of airplanes and by assigning the shipment to the
first airplane that can accommodate the shipment, starting at the beginning of the
airplaneList array. The Airline class also has a member function printSummary that
prints a list of airplanes with their current and maximum load. Empty airplanes should not be
printed in the summary. See the examples of output files for details on the output format.
Specification of the Airplane class
The Airplane class constructor takes one argument the maximum capacity of the airplane It
has accessor member functions maxLoad and currentLoad returning the maximum and
current number of containers respectively. The addContainers member function attempts to
add containers to the airplane and modifies the load accordingly. It returns true if the
operation is successful and false otherwise.
All compilations should complete without warnings use the Wall option Include only the
files Airline.cpp and Airplane.cpp in your hwptar file. Submit your project as file
hwptar using Gradescope.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
