PF Project
PF Project
#include <string>
#include <fstream>
#include <cstdlib>
#include <iomanip>
// _____________________________________
struct UserDetails {
string name;
string email;
string phone;
};
void clearScreen();
void seatBooking();
void stallBooking();
void bookByCall();
void bookByVisit();
void bookByWebsite();
void showAdvertisementOptions();
int main(){
int mainChoice;
validateInput(mainChoice);
switch (mainChoice){
case 1 :
seatBooking();
break;
case 2 :
stallBooking();
break;
case 3 :
break;
case 4:
showAdvertisementOptions();
break;
}}
// _____________________________________
}
}
// _____________________________________
void clearScreen() {
#ifdef _WIN32
system("cls");
#else
system("clear");
#endif
// _____________________________________
cin.ignore();
getline(cin, user.name);
getline(cin, user.email);
getline(cin, user.phone);
//______________________________________
// _____________________________________
cout << "Thank you, " << user.name << ". Your booking is confirmed."
<< endl;
cout << "Your total payment is: " << total << " PKR" << endl;
cout << "We will send the booking details to your email: " << user.email
<< "." << endl;
// _____________________________________
void seatBooking() {
int n, j, countNum = 0;
cout << "1. Front seats (Rs. 300 per seat)" << endl;
cout << "2. Mid seats (Rs. 200 per seat)" << endl;
cout << "3. Back seats (Rs. 100 per seat)" << endl << endl;
cout << "Which class of seat do you want to choose: " << endl;
cout << "1. Front seat (Seat no. 1 to 20 are front seats)\n";
cout << "2. Mid seat (Seat no. 21 to 60 are mid seats)\n";
cout << "3. Back seat (Seat no. 61 to 100 are back seats)\n" << endl;
validateInput(n);
int seatClass;
cout << "Select seat class (1 for Front, 2 for Mid, 3 for Back): ";
validateInput(seatClass);
if (seatClass == 1) {
validateInput(j);
cout << "Invalid seat number! Please choose a valid seat number
from 1 to 20.\n";
continue;
else {
cout << "Seat no. " << j << " has been successfully reserved."
<< endl << endl;
countNum++;
else if (seatClass == 2) {
cout << "Enter your desired seat number (21 to 60): ";
validateInput(j);
cout << "Invalid seat number! Please choose a valid seat number
from 21 to 60.\n";
continue;
cout << "You have already reserved this seat (seat no. " << j <<
"). Please choose another one." << endl << endl;
else {
countNum++;
else if (seatClass == 3) {
cout << "Enter your desired seat number (61 to 100): ";
validateInput(j);
cout << "Invalid seat number! Please choose a valid seat number
from 61 to 100.\n";
continue;
cout << "You have already reserved this seat (seat no. " << j <<
"). Please choose another one." << endl << endl;
else {
cout << "Seat no. " << j << " has been successfully reserved."
<< endl << endl;
countNum++;
else {
cout << "Invalid seat class! Please choose a valid option." << endl
<< endl;
cout << "Congratulations! You have successfully reserved " << countNum
<< " seats." << endl;
// Front seats
if (frontSeats[i]) {
// Mid seats
if (midSeats[i]) {
}
}
// Back seats
if (backSeats[i]) {
// _____________________________________
void stallBooking() {
while (true) {
int menuChoice;
validateInput(menuChoice);
if (menuChoice == 1) {
// Stall types and prices
int stallPrices[] = {500, 300, 400}; // Prices for each type of stall
int locationPrices[] = {200, 150, 100, 50}; // Prices for each location
while (true) {
//correction
int stallChoice;
while (true) {
cout << i + 1 << ". " << stallTypes[i] << " - $" <<
stallPrices[i] << endl;
validateInput(stallChoice);
}
// Get and validate stall location
int locationChoice;
while (true) {
cout << i + 1 << ". " << stallLocations[i] << " - $" <<
locationPrices[i] << endl;
validateInput(stallChoice);
int days;
while (true) {
cout << "\nEnter the number of days you want to book the stall:
";
validateInput(days);
if (days > 0) break;
totalCost += bookingCost;
cout << "\nCost for this booking: $" << bookingCost << endl;
cout << "Cumulative total cost so far: $" << totalCost << endl;
char choice;
while (true) {
cout << "\nDo you want to book another stall? (y/n): ";
cin>>choice;
break;
cout << "Final total cost for all bookings: $" << totalCost <<
endl;
return;
} else {
cout << "Invalid input! Please enter 'y' or 'n'.\n";
} else if (menuChoice == 2) {
return;
} else {
// _____________________________________
void bookByCall() {
cout << "For further assistance, you can reach us at +43 68999554." <<
endl;
// _____________________________________
void bookByVisit() {
cout << "OPTIMA ENDURANCE - Booking via Office Visit" << endl;
cout << "For further assistance, you can reach us at +43 68999554 or
email us at @gmail.com." << endl;
cout << "Our office address is: OPTIMA ENDURANCE, Lahore, Punjab,
Pakistan." << endl;
// _____________________________________
void bookByWebsite() {
double total = 0;
UserDetails user;
cout << "1. Book Only Ground (50,000 PKR per day)" << endl;
cout << "2. Book Ground + Seats (80,000 PKR per day)" << endl;
cout << "3. Book Ground + Seats + Stalls (80,000 PKR per day + 5,000
PKR per stall)" << endl;
while (true) {
cout << "Invalid choice. Please enter a valid option (1-3)." << endl;
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(), '\n');
else {
break;
cout << "Enter the number of days you want to book: ";
cout << "Invalid input. Please enter a positive number of days." <<
endl;
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(), '\n');
return;
if (subChoice == 1) {
cout << "You have chosen to book only the ground." << endl;
total = groundRate * days;
else if (subChoice == 2) {
cout << "You have chosen to book the ground with seats." << endl;
else if (subChoice == 3) {
cout << "You have chosen to book the ground with seats and stalls."
<< endl;
getDetails(user);
paymentDetails(user, total);
// _____________________________________
void privateBooking() {
int choice;
UserDetails user;
cout << "Invalid choice. Please enter a valid option (1-3)." << endl;
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(), '\n');
else {
break;
if (choice == 1) {
bookByCall();
else if (choice == 2) {
bookByVisit();
else if (choice == 3) {
bookByWebsite();
}
}
// _____________________________________
void showAdvertisementOptions() {
int selection = 0;
double totalAmount = 0;
const double prices[7] = {60.0, 70.0, 100.0, 120.0, 200.0, 50.0, 80.0};
"Banners Ad",
};
while (true) {
clearScreen();
cout << "\nSelect an Advertisement Type (or type 8 to confirm):\n";
cout << left << setw(3) << "No" << setw(30) << "Advertisement
Type" << setw(15) << "Price ($)" << endl;
<< endl;
if (!selectedAds[selection - 1]) {
selectedAds[selection - 1] = true;
cout << "You selected option " << selection << ".\n";
} else {
cout << "Option " << selection << " is already selected.\n";
} else if (selection == 8) {
break;
} else {
cout << "Invalid choice. Please select again.\n";
continue;
clearScreen();
cout << left << setw(3) << "No" << setw(30) << "Advertisement Type"
<< setw(15) << "Price ($)" << endl;
if (selectedAds[i]) {
<< endl;
totalAmount += prices[i];
cout << "\nYour total amount is: $" << totalAmount << endl;