Preview

Cprogramming

Better Essays
Open Document
Open Document
746 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Cprogramming
6. A small airline has just purchased a computer for its new automated reservations system. The president has asked you to program the new system. You are to write a program to assign seats on each flight of the airline’s only plane (capacity : 10 seats).

Your program should display the following menu of alternatives:

Please type 1 for “first class”
Please type 2 for “economy”

If the person types 1, then your program should assign a seat in the first class section (seats 1 – 5). If the person types 2, then your program should assign a seat in the economy section (seats 6 – 10). Your program should then print a boarding pass indication the pass indicating the person’s seat number and whether it is in the first class or economy section of the plane.

Use a single-subscripted array to represent the seating chart of the plane. Initialize all the elements of the arrays to 0 to indicate that all seats are empty. As each seat is assigned, set the corresponding elements of the array to 1 to indicate that the seat is no longer available.

Your program should, of course, never assign a seat that has already been assigned. When the first class section is full, your program should ask the person if it is acceptable to be placed in the economy section (and vice versa). If yes, then make the appropriate seat assignment. If no, then print the message “Next flight leaves in 3 hours.”
#include <stdio.h>

int main()
{
int counter1=0 , counter2=0; int seat[10]={0}; int selection , decision , seating1=1 , seating2=6; int i=0 , j=5 ; int loop=1; while (loop==1) { if(counter1 + counter2 ==10) { printf("\n*******************************************\n"); printf("All ticket are sold !!\n"); printf("Next flight will be leaves in 3 hours later.\n"); printf("*******************************************\n"); return 0; } printf("\n +---+---+---+---+---+\n"); printf("First Class : |");

You May Also Find These Documents Helpful

  • Better Essays

    A survey consisting of six questions (Appendix A) will be handed out to all passengers during flights for a one-month period. The returned surveys will serve as a database for this project and from which random samples are taken. For additional information, management can compare survey results to passenger data stored in the company database. The information generated from surveys and data mining will be analyzed to determine if there is a difference in passenger count for each day of the week.…

    • 969 Words
    • 4 Pages
    Better Essays
  • Satisfactory Essays

    Directions: Students will get into groups and work together to experience different kinds of airplane rides. Each student will participate in a different role at each new setting. Students are required to help with each task regardless of their role. Each student will turn in their own worksheet. This activity is worth 100 points.…

    • 57 Words
    • 1 Page
    Satisfactory Essays
  • Satisfactory Essays

    Mt445 Unit 7 Assignment

    • 453 Words
    • 3 Pages

    iii. FlyCheap Airlines purchases new seats to be installed on a jetliner it already owns.…

    • 453 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Ac 505: Case Study Two

    • 378 Words
    • 2 Pages

    Break even point in number of passenger cars per month (New fare and Average load factor)…

    • 378 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Business Data Model

    • 3130 Words
    • 13 Pages

    What is the probability that a randomly selected order will require between two and three minutes?…

    • 3130 Words
    • 13 Pages
    Good Essays
  • Satisfactory Essays

    Lab 3 Student

    • 1264 Words
    • 7 Pages

    Write a program that will take in basic information from a student, including their name and how many credits they have taken in Network Systems Administration program. The program will then calculate how many credits are needed to graduate. Display should include the student name and the number of credits left to graduate. This should be based off a 90 credit program, where some courses are half credits.…

    • 1264 Words
    • 7 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Delta Blue Airlines

    • 334 Words
    • 2 Pages

    Delta Blue Airlines operates a commuter flight between Charlotte and Philadelphia. The plane holds 30 passengers in Economy and 6 passengers in First Class. The airline makes a $100 profit on each passenger in Economy and $200 per passenger in First Class on the flight. When Delta Blue takes 30 Economy reservations and 6 First Class for the flight, experience has shown that on average, two passengers do not show up for each class. As a result, Delta Blue is averaging 28 Economy passengers and 4 First Class passengers with a profit of 28*$100 + 4*$200 = $3600 per flight. The airline operations office has asked for an evaluation of an overbooking strategy where they would accept 32 Economy reservations and up to 8 First Class reservations even though the airplane holds only 30 Economy and 6 First class passengers. The probability distribution for the number of passengers showing up with the new overbooking reservations policy is as follows:…

    • 334 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Concept Programing

    • 443 Words
    • 3 Pages

    a) Find a candidate loop invariant I. Show the induction steps using which you find I.…

    • 443 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Mgmt340 Week 4

    • 279 Words
    • 2 Pages

    6. An airline reservation is an association between a passenger, a flight, and a seat. Select a few pertinent attributes for each of these entity types and represent a reservation in an E-R…

    • 279 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Leason Plan Paper

    • 505 Words
    • 3 Pages

    The agents will become proficient in the automation systems used by airlines and gain skills of interpreting fare quote displays and rule displays, pricing and ticketing.…

    • 505 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    economics

    • 291 Words
    • 2 Pages

    Problem #5 >>Answer Yes I believe the airline should accept a charter flight proposal from a group that offers to guarantee the sale of 90 seats over 250, because the risk varies highly because its only 90 seats and realistically those 90 seats will be a guaranteed buy opposed to 250. So it will be a great advantage to the airline to do that plus sales increase.…

    • 291 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    SA want to find an improvement in passenger boarding process.We know that ground operations and boarding process need to take place simultaneously and as quickly as possible since a delay can cause longer turnaround times. . Therefore, The theory of constraints show that Southwest airline has to identify and manage the bottleneck which may occur in passenger boarding process and maximize their profit. In the case, the constraints in passenger boarding process are passenger sequence and the priority rules in passenger sequence. So 7 boarding scenarios were designed and tested by Southwest airlines in order to find a better way to aboard.…

    • 559 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Bluej Menu Driven Program

    • 1040 Words
    • 5 Pages

    The question here is that, Write a BlueJ program which will ask the user to enter a choice and based on the choice the following operation will take place.…

    • 1040 Words
    • 5 Pages
    Good Essays
  • Powerful Essays

    They now offer, as an option, the choice of seats through Xpress Boarding. Xpress boarding allows guests to board on aircraft first, and choose a seat of their liking-be it a window seat, asle seat, front of aircraft or next to the lavatory. This service has proven to be exceptionally popular for time hungry…

    • 1567 Words
    • 7 Pages
    Powerful Essays
  • Satisfactory Essays

    ticket kannan srinivasan

    • 292 Words
    • 5 Pages

    Seats are unassigned on one or more of your flights. The airline will assign your seats at check-in.…

    • 292 Words
    • 5 Pages
    Satisfactory Essays