Answer to Question #12174 in C# for Gia

Question #12174
Lojack Airline allows a passenger only two pieces of luggage. The heavier bag can be at most 80 pounds but the total weight of the two should not exceed 100 pounds. Make a program that would input the weight of the two bags in any order and output whether the weight of the bags in any order and output whether the luggages are allowable or not. Use the output format below. LOJACK AIRLINE WEIGHT OF FIRST BAG :<value entered> WEIGHT OF SECOND BAG :<value entered> STATUS :<status> LUGGAGE FEE :<fee> Notes: 1. Status is either ‘WEIGHT ALLOWABLE’ or WEIGHT NOT ALLOWABLE 2. Luggage fee is Weight Fee Below 40 ₱10 41 to 75 ₱12 76 to 100 ₱15 Not allowable ₱0
Expert's answer
class Program
{
static void Main(string[] args)
{
Console.Write("LOJACK AIRLINE");
Console.Write("WEIGHT OF FIRST BAG: ");
int weight1 = int.Parse(Console.ReadLine());
Console.WriteLine("WEIGHT OF SECOND BAG: ");
int weight2 = int.Parse(Console.ReadLine());
if((weight1 > 80) ||(weight2 > 80) || (weight1 + weight2 >
100)){
Console.WriteLine("STATUS: WEIGHT NOT ALLOWABLE");
Console.WriteLine("LUGGAGE FEE: ₱0");
}
else{
Console.WriteLine("STATUS: WEIGHT ALLOWABLE");
if(weight1+weight2 <= 40)
Console.WriteLine("LUGGAGE FEE: ₱10");
else if (weight1+weight2 <= 75)
Console.WriteLine("LUGGAGE FEE: ₱12");
else
Console.WriteLine("LUGGAGE FEE: ₱15");
}
}
}

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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal