Answer to Question #35589 in C# for karuna tripathi
maximum amount of luggage that can be carried by a passenger depends on the class in which
the passenger is travelling. The following table lists the maximum amount of luggage allowed for
If a passenger carries luggage above the maximum amount permissible for the class in which
he/she is travelling in, the passenger is levied an additional cost at the rate of $2/additional KG.
Currently, this cost is calculated manually, which is a time consuming process. Therefore, the
management of FlyHigh Airlines has asked SoftSols Inc. to create an application that accepts the
total weight of a luggage carried by a passenger, checks whether it is more than the maximum
amount allowed for the passenger's class of travel, and then calculates the additional cost that
needs to be levied on the passenger. In addition, SoftSols Inc. needs to ensure that the application
is able to handle the weight of luggage in whole numbers as well as decimal numbers.
Write the code that SoftSols Inc. should use to create the desired application. [10 Marks]
Class Maximum Amount of
First class 50 KGs
Business class 40 KGs
Economy class 20 KGs
string class_of_travel; // passenger's class of travel
double luggage_weight; //total weight of a luggage
double overweight; double additional_fee;
case "First class":
overweight = luggage_weight-50;
case "Business class":
overweight = luggage_weight-40;
case "Economy class":
overweight = luggage_weight - 20;
if (overweight < 0) //no owerweight
additional_fee = 0;
additional_fee = overweight * 2;
// result is additional_fee
Need a fast expert's response?Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
You're welcome. We are glad to be helpful.
If you really liked our service please press like-button beside answer field. Thank you!
it's very helpful