472,146 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

how to write airline reservation system program in c.

10
A small airline has just purchased a computer for its new automated reservations system. You have been asked 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 "smoking"
Please type 2 for "non-smoking"

If the person types 1, your program should assign a seat in the smoking section(seats 1 - 5).If the person types 2, your program should assign a seat in the non-smoking section (seats 6 - 10). Your program should then display a boarding pass indicating the person's seat number and whether it is in the smoking or non-smoking section of the plane.

Use an array to represent the seating chart of the plane. Initialize all the elements of the array 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
Nov 10 '08 #1
6 22375
Banfa
9,065 Expert Mod 8TB
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

Then when you are ready post a new question in this thread.

Banfa
Administrator
Nov 10 '08 #2
this solution is for visual basic
ENJOY

[ off topic spoonfeeding solution deleted ]
Jan 1 '09 #3
weaknessforcats
9,208 Expert Mod 8TB
To devilprogrammer: This is a C/C++ forum. Visual Basic is not spoken here nor can you post complete solutions. Please do as Banfa asks and follow the posting guidelines.
Jan 1 '09 #4
i found it while searching in Visual Basic its solution but there was no solution available for it so i built this program for myself .... & thought why not to share it with others so they can get full marks....assignments are given to be done....
i don't care
Regards
devil programmer
Jan 1 '09 #5
JosAH
11,448 Expert 8TB
@devilprogrammer
This forum doesn't care about your off topic solution either so it has been deleted. Full marks are only to be deserved for original work, not for copying and pasting other people's spoonfeeding; don't do that anymore.

kind regards,

Jos (moderator)
Jan 1 '09 #6
Tassos Souris
152 100+
I think that the remark of the exercise already gives the solution:
Expand|Select|Wrap|Line Numbers
  1. int seats[ 11 ]; // if you want to start counting from 1 
  2. int smoking = 1; // where the seats for the Smoking-Category start
  3. int nonsmoking = 6; // where the seats for the Non-Smoking Category start
  4.  
  5. // initialize the seats[] to all zero if it is not already
  6.  
  7. // Read what the user wants (1 or 2) checking input.. Use a combination of
  8. // fgets() and strtol()
  9.  
  10. // If user wants the Smoking Category
  11.     // If there are more available seats for the smoking category 
  12.               (in which bounds should the smoking variable be?)
  13.         // Notify the user about the reservation (user fprintf())
  14.         // Update the seats[] array (assign 1 to the taken seat)
  15.     // Else (no more seats)
  16.         // Notify the user that no more seats are available (use fprintf())
  17.         // Use your own strategy here... you can ask user if he wants a seat
  18.         // in the Non-Smoking Category
  19.     // EndIf
  20. // Else (the user wants the Non-Smoking Category)
  21.     // The same as above (except you use the nonsmoking variable instead
  22.     // of the smoking variable
  23. // EndIf
  24.  
After you implement the above simple algorithm you can of course change it to use less if's and make it better,,,, It's up to you...

Hope i helped!
Jan 10 '09 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

11 posts views Thread by Robert | last post: by
2 posts views Thread by cotty | last post: by
reply views Thread by Saiars | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.