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 exceeed 100 pounds.Please help me create a program that would input the weight of the two bags in any order and output whether the weight of the two bags in any order and output whether the luggages are allowable or not. This is the output format:
LOJACK AIRLINE
WEIGHT OF FIRST BAG :<value entered>
WEIGHT OF SECOND BAG :<value entered>
STATUS :<status>
LUGGAGE FEE :<fee>
1
Expert's answer
2012-07-20T12:12:48-0400
using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace TEMP { class Program { & static void Main(string[] args) & { Console.Write(" Enter weight of first bag: "); double first = Convert.ToDouble(Console.ReadLine()); Console.Write("Enter weight of second bag: "); double second = Convert.ToDouble(Console.ReadLine()); bool allowable = false; if ((first<80) && (second<80) && (first+second<100)){ allowable = true; }
Console.WriteLine(); Console.WriteLine("LOJACK AIRLINE"+"\n"); Console.WriteLine( "WEIGHT OF FIRST BAG " + first); Console.WriteLine("WEIGHT OF SECOND BAG " + second); Console.WriteLine(); Console.WriteLine("STATUS " + ((allowable) ? "allowable" : "not allowable")); Console.ReadLine(); & } } }
Comments
Leave a comment