Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include #include #include #include #include using namespace std; / / Tour Package class class TourPackage { public: string name; string location; double price; map reservations;
#include
#include
#include
#include
#include
using namespace std;
Tour Package class
class TourPackage
public:
string name;
string location;
double price;
map reservations; date number of seats reserved
TourPackagestring name, string location, double price
: namename locationlocation priceprice
void addReservationstring date, int seats
if reservationsfinddate reservations.end
reservationsdate seats;
else
reservationsdate seats;
void deleteReservationstring date, int seats
if reservationsfinddate reservations.end
if reservationsdate seats
reservationsdate seats;
if reservationsdate
reservations.erasedate;
else
throw runtimeerrorNot enough seats reserved for deletion";
else
throw runtimeerrorNo reservation found for deletion";
bool isSeatsAvailablestring startDate, string endDate, int seats
for auto it reservations.begin; it reservations.end; it
if itfirst startDate && itfirst endDate
if itsecond seats
return false;
return true;
;
Tourism Company class
class TourismCompany
public:
vector tourPackages;
void addTourPackagestring name, string location, double price
tourPackages.pushbackTourPackagename location, price;
void viewTourPackages
for auto it tourPackages.begin; it tourPackages.end; it
cout "Name: itname Location: itlocation Price: itprice endl;
void updateTourPackagestring name, string location, double price
for auto it tourPackages.begin; it tourPackages.end; it
if itname name
itlocation location;
itprice price;
return;
throw runtimeerrorTour package not found for update";
void deleteTourPackagestring name
for auto it tourPackages.begin; it tourPackages.end; it
if itname name
tourPackages.eraseit;
return;
throw runtimeerrorTour package not found for deletion";
void addReservationstring packageName, string date, int seats
for auto it tourPackages.begin; it tourPackages.end; it
if itname packageName
itaddReservationdate seats;
return;
throw runtimeerrorTour package not found for reservation";
void viewReservationsstring packageName
for auto it tourPackages.begin; it tourPackages.end; it
if itname packageName
for auto it itreservations.begin; it itreservations.end; it
cout "Date: itfirst Seats: itsecond endl;
return;
throw runtimeerrorTour package not found for viewing reservations";
void deleteReservationstring packageName, string date, int seats
for auto it tourPackages.begin; it tourPackages.end; it
if itname packageName
itdeleteReservationdate seats;
return;
throw runtimeerrorTour package not found for reservation deletion";
bool isSeatsAvailablestring packageName, string startDate, string endDate, int seats
for auto it tourPackages.begin; it tourPackages.end; it
if itname packageName
return itisSeatsAvailablestartDate endDate, seats;
throw runtimeerrorTour package packageName not found for reservation";
;
int main
TourismCompany company;
while true
cout Add Tour Package" endl;
cout View Tour Packages" endl;
cout Update Tour Package" endl;
cout Delete Tour Package" endl;
cout Add Reservation" endl;
cout View Reservations" endl;
cout Delete Reservation" endl;
cout Check Seat Availability" endl; show me the erros
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started