An airplane operates planes which have first class and economy seats. If the customer approaches a tcket clerk, the clerk ask which type of seat is wanted. If that type is available, a ticket is issued for that seat. If not available, the customer is asked if the alternate type of seat would be acceptable(provide one is available)If it is acceptable, a ticket of the alternative type is issued.If it is not acceptable. A ticket of the alternate type is issued. If it is not acceptable, no ticket is issued. Write a program that would display either ‘ISSUE FIRST CLASS’,‘ISSUE ECONOMY’,or ‘DO NOT ISSUE TICKET’based on output codes entered.The input codes are defined as follows:
Class code1=cstomer wants first class 2=customer wants economy class
Alternative code 1=cstomer will take alternative type.2=customer won’t take alternative type.
Availability Code of First 1=first class seat is available. 2=first class seat is not available class.
Avbility Code Ecnmy1=economy seat is availability2=economy seat is available.
1
Expert's answer
2012-07-26T08:51:54-0400
int classT = 0; int altT = 0; int avalF = 0; int avalE = 0; Console.WriteLine("Enter ticket class: "); classT = int.Parse(Console.ReadLine());
switch (classT){ case 1: {
Console.WriteLine("Enter avaliability of first class: ");
avalF = int.Parse(Console.ReadLine()); switch (avalF) { case 1: Console.WriteLine("ISSUE FIRST CLASS"); break; case 2:{ Console.WriteLine("Is alternate ticket acceptable? "); altT = int.Parse(Console.ReadLine()); switch (altT){ case 1:{ Console.WriteLine("Enter avaliability of econom class: ");
avalE = int.Parse(Console.ReadLine());
switch (avalE) { case 1: Console.WriteLine("ISSUE ECONOM CLASS");
break; case 2: Console.WriteLine("DO NOT ISSUE TICKET");
break;
}
break;
} case 2: { Console.WriteLine("DO NOT ISSUE TICKET");
break;
}
}
break; }
} break; } case 2: { Console.WriteLine("Enter avaliability of econom class: "); avalE = int.Parse(Console.ReadLine()); switch (avalE){ case 1: Console.WriteLine("ISSUE ECONOM CLASS"); break; case 2: { Console.WriteLine("Is alternate ticket acceptable? "); altT = int.Parse(Console.ReadLine()); switch (altT) { case 1: { Console.WriteLine("Enter avaliability of first class: ");
avalF = int.Parse(Console.ReadLine());
switch (avalF) { case 1: Console.WriteLine("ISSUE FIRST CLASS");
break; case 2: Console.WriteLine("DO NOT ISSUE TICKET");
break;
}
break;
} case 2:{ Console.WriteLine("DO NOT ISSUE TICKET");
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment