i need a help in airline reservation system project in c n i dont no how to do that so plz tell me the codes for these
we should allow the user to chose
1)to book
2)to cancel
3)view data
4)quit
as well as they have to enter them name age passport no choose from 4 destination if it 2ways or 1 way and the seats as well as the time choose how many adult starting from 13years children(2-under13) infant(0-2) display the charge if it a child so 75% of the charge if infant10% of the charge and at the end display the whole data and the number of the flight as well but if cancellation so only 60% of the charge if it at the same day
jane bella 0 Newbie Poster
Edited by jane bella because: n/a
Dani AI
Generated
A compact plan and practical starting point to turn ’s description into a working C program. There are two small contradictions in the thread (child fare shown as 75% in one post and 60% in another, and the “same‑day” refund rule is stated ambiguously). Pick the business rules up front and make them configurable via macros so the rest of the code stays simple.
Use a single struct for each booking (as suggested), keep an in‑memory array for development, then persist to a file (CSV or binary). Use the passport string as the lookup key for view/cancel. Validate inputs (no buffer overflows, sensible age, seat availability per flight). Implement small functions: book(), cancel(), view(), save() and load().
Example data model and pricing formula (change CHILD_FACTOR to 0.75 or 0.60 according to your chosen rule):
#define MAXNAME 64
#define MAXPASSPORT 16
#define ADULT_FACTOR 1.00
#define CHILD_FACTOR 0.60 /* set to 0.75 if wanted */
#define INFANT_FACTOR 0.10
typedef enum { ONE_WAY=0, RETURN=1 } TripType;
typedef struct {
char name[MAXNAME];
char passport[MAXPASSPORT];
int age;
TripType trip;
int flight_id; /* 0..3 for four destinations */
int seats;
char date[11]; /* YYYY-MM-DD */
double paid;
} Reservation;
/* pricing */
double compute_price(double base, int a,int c,int i, TripType t) {
double mult = (t==RETURN)?2.0:1.0;
return base * mult * (a*ADULT_FACTOR + c*CHILD_FACTOR + i*INFANT_FACTOR);
} Implementation tips: store base prices in an array indexed by flight_id; implement cancellation refund as refund = paid * (is_same_day ? 0.60 : 1.0) (or whatever rule you pick) and document that definition of “same day”; use fgets() to read names, check passport uniqueness before booking, and write simple unit tests (book → view → cancel → view) to validate behavior.
MarounMaroun 0 Light Poster
I didn't understand what you wanted to do, but anyway:
You should have a struct that represents a reservation.
This struct will contain the relevant information about the reservation.
Please post some more information about what do you want to do.
Edited by MarounMaroun because: n/a
jane bella 0 Newbie Poster
c i studied c for 1 month now and i want the codes for this program i will give u mor info for the program at the menu of the program this should be display that
1)to book
2)to cancel
3)view data
4)quit
so when the user press 1 it should go for booking when it go for booking the it should allow the user to choose destination from four destination and the charge of every destination should be written then they should choose if it is one way or 2 ways then choose the day time and then choose how many passenger and how many of them are adult children infant then allow them to enter them name age passport number and then display the charge for the tickets if there is any adult then 100% of the charge children 60% and infant 10%.but if the user entered 2 then it should go for cancellation so the user after he enter his passport number should be allowed to cancel his booking with a full charge back but if the cancellation were at the same time then only 60% of the charge and for view data after the user enter his passport number they should display the whole data of the booking. plzzzzzzzzzzz help me i dont no how to do this at all so plzz tell me wat should i do thank u :)
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.