Define a class Luggage that represents pieces of luggage. Each Luggage object should have a length, width, and height—measured in inches—and a weight in pounds. These objects should be immutable....


Define a class Luggage that represents pieces of luggage. Each Luggage object should have a length, width, and height—measured in inches—and a weight in pounds. These objects should be immutable. Using your new class, write a program that processes an airline passenger who has two pieces of luggage. Up-and-Away Airlines allows each passenger a total luggage weight of at most 50 pounds without an additional charge. Moreover, each piece of luggage must satisfy a size requirement; that is, the sum of its length, width, and height must be less than or equal to 62 inches. Oversized luggage is assessed a charge of $5 per piece. Overweight luggage is assessed a charge of $2 per pound over the 50-pound maximum. Your program should ask the user for the size and weight of each piece of luggage, indicate whether an additional charge is required and, if so, the amount of the charge. For example, the output of the program might appear as follows:


Type the length, width, and height, in inches and separated by spaces, of the first piece of luggage: 36.5 24 9.5


Type its weight in pounds: 48.5


The dimensions 36.5 x 24.0 x 9.5 total 70.0 inches. This piece is oversized and incurs a $5 charge.


Type the length, width, and height, in inches and separated by spaces, of the second piece of luggage: 24.5 8 6.5


Type its weight in pounds: 37.25


The dimensions 24.5 x 8.0 x 6.5 total 39.0 inches. This piece is acceptable. The total weight of the two pieces is 85.75 pounds, which is 35.75 pounds over the limit. The charge at $2 per pound is $71.50


Total luggage charge is $76.50.

May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here