#include <iostream>
#include <string>
Using namespace std;
Void confirmPayment() {
Char paymentConfirmation;
Cout << “Have you done your payment y/n” << endl;
Cin >> paymentConfirmation;
If (paymentConfirmation == ‘y’) {
Cout << “Thank You! Your ticket is booked. Reach at Bus station 20 minutes earlier!
Otherwise you miss the bus!” << endl;
} else if (paymentConfirmation == ‘n’) {
Cout << “Your ticket will be cancelled within 20 minutes if you don’t pay!” << endl;
Int main() {
String name, cnic;
Int cityChoice, timeChoice, busTypeChoice, seatNumber, motorwayChoice;
Int extraCost = 0;
String cities[] = {“Islamabad”, “Narowal”, “Sialkot”, “Rawalpindi”};
String times[4][2] = {{“7am”, “7pm”}, {“9am”, “4pm”}, {“5am”, “6pm”}, {“4am”, “7pm”}};
Int prices[4][2] = {{3000, 3500}, {1600, 1500}, {1400, 1500}, {4000, 4000}};
Int durations[4][2] = {{240, 210}, {120, 130}, {120, 150}, {210, 240}};
Int seats[3] = {20, 25, 18};
Cout << “=============================” << endl;
Cout << “ Daewoo Bus Ticket Service “ << endl;
Cout << “=============================” << endl;
Cout << “\nEnter your name Dear!: “;
Cin >> name;
Cout << “ Now add your CNIC: “;
Cin >> cnic;
Menu:
Cout << “\nSelect your city route:\n” << endl;
For (int I = 0; I < 4; ++i) {
Cout << I + 1 << “) Lahore to “ << cities[i] << endl;
For (int j = 0; j < 2; ++j) {
Cout << “ “ << times[i][j] << “ – “ << prices[i][j] << “ PKR – “
<< durations[i][j] / 60 << “ hours and “ << durations[i][j] % 60 << “ minutes” << endl;
Cout << endl;
Cout << “Enter your choice (1-4): “;
Cin >> cityChoice;
If (cityChoice < 1 || cityChoice > 4) {
Cout << “\nInvalid city choice!” << endl;
System(“pause”);
System(“cls”);
Goto menu;
Cout << “\nSelect your travel time:\n” << endl;
For (int I = 0; I < 2; ++i) {
Cout << I + 1 << “) “ << times[cityChoice – 1][i] << “ – “ << prices[cityChoice – 1][i] << “
PKR – “
<< durations[cityChoice – 1][i] / 60 << “ hours and “ << durations[cityChoice – 1][i] %
60 << “ minutes” << endl;
Cout << “\nEnter your choice (1-2): “;
Cin >> timeChoice;
If (timeChoice < 1 || timeChoice > 2) {
Cout << “\nInvalid time choice!” << endl;
Return 1;
busMenu:
cout << “\nSelect your bus type:\n” << endl;
cout << “1) Business Class – Available seats: “ << seats[0] << endl;
cout << “2) Executive Class – Available seats: “ << seats[1] << endl;
cout << “3) High Roof – Available seats: “ << seats[2] << endl;
cout << “\nEnter your choice (1-3): “;
cin >> busTypeChoice;
if (busTypeChoice < 1 || busTypeChoice > 3) {
cout << “\nInvalid bus type choice!” << endl;
system(“pause”);
system(“cls”);
goto busMenu;
seatSelection:
cout << “\nSelect your seat number (1-“ << seats[busTypeChoice – 1] << “): “;
cin >> seatNumber;
if (seatNumber < 1 || seatNumber > seats[busTypeChoice – 1]) {
cout << “\nInvalid seat number!” << endl;
goto seatSelection;
Cout << “\nDo you want to travel through the motorway?\n”;
Cout << “1) Yes (+500 PKR)\n”;
Cout << “2) No\n”;
Cout << “Enter your choice (1-2): “;
Cin >> motorwayChoice;
If (motorwayChoice == 1) {
extraCost = 500;
} else if (motorwayChoice != 2) {
Cout << “\nInvalid motorway choice!” << endl;
Return 1;
Cout << “\n=============================” << endl;
Cout << “ Ticket Confirmation “ << endl;
Cout << “=============================” << endl;
Cout << “Name: “ << name << endl;
Cout << “CNIC: “ << cnic << endl;
Cout << “Bus Type: “;
If (busTypeChoice == 1) cout << “Business Class” << endl;
Else if (busTypeChoice == 2) cout << “Executive Class” << endl;
Else cout << “High Roof” << endl;
Cout << “Route: Lahore to “ << cities[cityChoice – 1] << endl;
Cout << “Time: “ << times[cityChoice – 1][timeChoice – 1] << endl;
Cout << “Price: “ << prices[cityChoice – 1][timeChoice – 1] + extraCost << “ PKR” << endl;
Cout << “Seat Number: “ << seatNumber << endl;
Cout << “\nYour ticket is booked.” << endl;
Cout << “For the travel, reach at Thokar Niaz Baig bus station.” << endl;
Cout << “=============================” << endl;
Cout << “\nSelect your payment method:\n”;
Cout << “1) JazzCash\n”;
Cout << “2) EasyPaisa\n”;
Cout << “3) Bank Account\n”;
Int paymentChoice;
Cout << “\nEnter your choice (1-3): “;
Cin >> paymentChoice;
Switch (paymentChoice) {
Case 1:
Cout << “\nYou selected JazzCash. Please complete your payment via JazzCash app
or agent.\n”;
Break;
Case 2:
Cout << “\nYou selected EasyPaisa. Please complete your payment via EasyPaisa app
or agent.\n”;
Break;
Case 3:
Cout << “\nYou selected Bank Account. Please complete your payment via online
banking or bank branch.\n”;
Break;
Default:
Cout << “\nInvalid payment method choice!” << endl;
Return 1;
Cout << “=============================” << endl;
confirmPayment();
return 0;