0% found this document useful (0 votes)
7 views2 pages

Mindfire Tech Interview Problem

The document contains a C++ code snippet defining three classes: Plane, Schedule, and Passenger, each with their respective attributes and methods. It also outlines a database schema with primary and foreign keys for managing flight bookings, including relationships between passengers, seats, and flights. Additionally, there is a SQL query example for retrieving passenger names and seat types based on their bookings.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Mindfire Tech Interview Problem

The document contains a C++ code snippet defining three classes: Plane, Schedule, and Passenger, each with their respective attributes and methods. It also outlines a database schema with primary and foreign keys for managing flight bookings, including relationships between passengers, seats, and flights. Additionally, there is a SQL query example for retrieving passenger names and seat types based on their bookings.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

class Plane{

private:
int plane_id;
int seat_no;

public:
void Plane(int seat_num, int plane_ID)
{
seat_no = seat_num;
plane_id = plane_ID;
}
void get_details()
{
cout<<plane_id<<endl;
cout<<seat_no<<endl;
}
};

class Schedule{
private:
int time;
string start_place, end_dstn;

public:
Schedule(int t, string start, string end)
{
time = t;
start_place = start;
end_dstn = end;
}
void get_schedule_details()
{
cout<<time<<endl;
cout<<start_time<<endl;
cout<<end_dstn<<endl;
}
};

class passenger{
private:
string name;

public:
passenger(string nm)
{
name = nm;
}
void get_details()
{
cout<<"Passenger Name:"<<name<<endl;
}
};

Plane : flight_id -->primary key, start_dest, end_dest, time, flight_no


Seats : seat_id --> primary key, flight_id -->foreign key, seat_type, seat_no
Passenger : Passenger_id --> primary key , name, seat_id--> foreign key, flight_id;

booking: id, Seat_id, flight_id, passenger_id


Select [Link], s.seat_type, from Passenger p join Seats s on p.seat_id = s.seat_id
and Passenger p join plane on p.flight_id = pl.flight_id;

You might also like