string class_of_travel; // passenger's class of travel
double luggage_weight; //total weight of a luggage
double overweight; double additional_fee;
switch (class_of_travel)
{
case "First class":
overweight = luggage_weight-50;
break;
case "Business class":
overweight = luggage_weight-40;
break;
case "Economy class":
overweight = luggage_weight - 20;
break;
default:
//incorrect input
break;
}
if (overweight < 0) //no owerweight
additional_fee = 0;
else //owerweight
additional_fee = overweight * 2;
// result is additional_fee
Comments
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 thanku
Leave a comment