0% found this document useful (0 votes)
37 views

Travel Packages Coding

This document contains code for a group project that allows users to book travel packages. It includes functions to calculate prices and display menus and invoices. The program allows the user to choose a travel package, view a list of customer bookings, and exit the program. It stores customer details and calculates total prices for bookings made.

Uploaded by

aqim azaha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Travel Packages Coding

This document contains code for a group project that allows users to book travel packages. It includes functions to calculate prices and display menus and invoices. The program allows the user to choose a travel package, view a list of customer bookings, and exit the program. It stores customer details and calculates total prices for bookings made.

Uploaded by

aqim azaha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

12/11/2019 Group Project CSC.

html

#include <iostream>
#include <stdlib.h>
#include <string.h>
#include<iomanip>
using namespace std;

double destFare (int companyCode);


double calcService (double destPrice);
double calcTax (double destPrice, double &priceTax);
double totPrice (double destPrice, double priceService, double tax, int i);
int menuOption();

char contact [12], company[99], destination[30], paymentCode, destCode, ans, ans2;


string name[9999], ic[999];
int noAdult, noChild, companyCode, i=0, user=0,menu;
double adult, children, priceService, destPrice, priceTax, totalPrice[999], tax, total;

main ()
{
do
{
menu=menuOption();

if(menu==1)
{
do
{
user++;
system("CLS");
cout.setf(ios::left);
cout << "-------------------------WELCOME TO TRAVEL PACKAGE-------------------------" << endl;
cout<<"\n---------------------------------------------------------------------------"<<endl;
cout<<setw(10)<<" CODE"<<setw(15)<<"COMPANY"<<setw(30)<<"DESTINATION"<<setw(20)<<"PRICE"<<endl;
cout<<"---------------------------------------------------------------------------"<<endl;
cout<<setw(10)<<" 1"<<setw(15)<<"AIR ASIA"<<setw(30)<<"(A) PULAU LANGKAWI"<<setw(20)<<"ADULT\tRM294.30"<<endl;
cout<<setw(10)<<""<<setw(15)<<""<<setw(30)<<""<<setw(20)<<"CHILDREN\tRM255.50"<<endl;
cout<<setw(10)<<""<<setw(15)<<""<<setw(30)<<"(B) PULAU TIOMAN"<<setw(20)<<"ADULT\tRM484.00"<<endl;
cout<<setw(10)<<""<<setw(15)<<""<<setw(30)<<""<<setw(20)<<"CHILDREN\tRM344.00"<<endl;
cout<<setw(10)<<""<<setw(15)<<""<<setw(30)<<"(C) PULAU PANGKOR"<<setw(20)<<"ADULT\tRM510.00"<<endl;
cout<<setw(10)<<""<<setw(15)<<""<<setw(30)<<""<<setw(20)<<"CHILDREN\tRM398.00"<<endl;

cout<<setw(11)<<"\n 2"<<setw(15)<<"MALINDO AIRLINES"<<setw(30)<<"(A) KOTA KINABALU"<<setw(20)<<"ADULT\tRM1559.65"<<endl


cout<<setw(10)<<""<<setw(15)<<""<<setw(30)<<""<<setw(20)<<"CHILDREN\tRM1091.76"<<endl;
cout<<setw(10)<<""<<setw(15)<<""<<setw(30)<<"(B) KUCHING"<<setw(20)<<"ADULT\tRM1708.00"<<endl;
cout<<setw(10)<<""<<setw(15)<<""<<setw(30)<<""<<setw(20)<<"CHIlDREN\tRM1220.00"<<endl;
cout<<setw(10)<<""<<setw(15)<<""<<setw(30)<<"(C) BRUNEI"<<setw(20)<<"ADULT\tRM2206.80"<<endl;
cout<<setw(10)<<""<<setw(15)<<""<<setw(30)<<""<<setw(20)<<"CHILDREN\tRM1544.76"<<endl;

cout<<setw(11)<<"\n 3"<<setw(15)<<"MAS AIRLINES"<<setw(30)<<"(A) SINGAPORE"<<setw(20)<<"ADULT\tRM780.00"<<endl;


cout<<setw(10)<<""<<setw(15)<<""<<setw(30)<<""<<setw(20)<<"CHILDREN\tRM546.00"<<endl;
cout<<setw(10)<<""<<setw(15)<<""<<setw(30)<<"(B) HATYAI, THAILAND"<<setw(20)<<"ADULT\tRM849.00"<<endl;
cout<<setw(10)<<""<<setw(15)<<""<<setw(30)<<""<<setw(20)<<"CHIlDREN\tRM594.30"<<endl;
cout<<setw(10)<<""<<setw(15)<<""<<setw(30)<<"(C) BALI, INDONESIA"<<setw(20)<<"ADULT\tRM959.00"<<endl;
cout<<setw(10)<<""<<setw(15)<<""<<setw(30)<<""<<setw(20)<<"CHILDREN\tRM671.30"<<endl;

cout << "-----------------------------------------------------------------------------" << endl;

cout << "\nNAME\t\t\t: ";


cin>>ws;
getline(cin, name[i]);
cout << "IDENTIFICATION CARD (IC): ";
cin>>ws;
getline(cin, ic[i]);
cout << "CONTACT NUMBER\t\t: ";
cin.getline (contact,12);
cout << "CHOOSE COMPANY CODE (1/2/3): ";
cin >> companyCode;

destPrice = destFare (companyCode);


priceService = calcService (destPrice);
tax = calcTax (destPrice, priceTax);
totalPrice[i] = totPrice (destPrice,priceService,tax,i);

system("CLS");
cout.setf(ios::left);
cout.setf(ios::fixed);
cout.precision(2);

cout<< "\n\t\t\t\tINVOICE RECEIPT" <<endl;


cout<<"\n\t||\tINVOICE NUMBER\t: #"<<setw(32)<<rand()<<"\t||"<<endl;
cout<<"\t||\tTO\t\t: "<<setw(33)<<name[i] <<"\t||"<<endl;
cout<<"\t||\tNRIC\t\t: "<<setw(33)<<ic[i]<<"\t||"<<endl;
cout<<"\t||\tPHONE NUMBER\t: "<<setw(33)<<contact<<"\t||"<<endl;
cout<<"\t||\t--------------------------------------------------"<<"\t||"<<endl;
cout<<"\t||\tREFERENCE:- "<<setw(20)<<company<<" - "<<setw(20)<<destination<<" ||"<<endl;
cout<<"\t||\t--------------------------------------------------"<<"\t||"<<endl;
cout<<"\t||\tNO.\tDESCRIPTION\t\tUNIT PRICE\t\t||"<<endl;
cout<<"\t||\t 1\tPrice Package\t\tRM "<<setw(10)<<destPrice<<"\t\t||"<<endl;
cout<<"\t||\t 2\tService charges\t\tRM "<<setw(10)<<priceService<<"\t\t||"<<endl;
cout<<"\t||\t 3\tTax Charges\t\tRM "<<setw(10)<<tax<<"\t\t||"<<endl;
cout<<"\t||\t 2\tTotal Charges\t\tRM "<<setw(10)<<totalPrice[i]<<"\t\t||"<<endl;

cout<<"\n\nDo you want to enter another user? (Y-Yes/N-No) : ";


cin>>ans;

i++;

file:///C:/Users/asus/Desktop/CSC/Mini project/6/Group Project CSC.html 1/4


12/11/2019 Group Project CSC.html
}while(ans=='y'||ans=='Y');
}

else if(menu==2)
{
system("CLS");
cout.setf(ios::left);

cout<<"\n---------------------------------------------------------------------------"<<endl;
cout<<setw(30)<<"Customer Name"<<setw(30)<<"Customer's ID"<<setw(10)<<"Total Price(RM)"<<endl;
cout<<"---------------------------------------------------------------------------"<<endl;

for(i=0;i<user;i++)
{

cout<<setw(30)<<name[i]<<setw(30)<<ic[i]<<"RM"<<totalPrice[i]<<endl;

}
cout<<"---------------------------------------------------------------------------"<<endl;
}

else if(menu==3)
{
system("CLS");
cout<<"\n\t\t ===================================="<<endl;
cout<<"\t\t\tThank you for using our system!"<<endl;
cout<<"\t\t ===================================="<<endl;
return 0;
}

else
{
cout<<"Invalid option."<<endl;
}

cout<<"\n\nDisplay menu option?(Y-Yes/N-No): ";


cin>>ans2;

}while(ans2=='Y'||ans2=='y');

int menuOption()
{
system("CLS");
cout<<"\n\t\t\tWELCOME TO SMART TRAVEL"<<endl;
cout<<"\t\t========================================="<<endl;
cout<<"\t\t||\t1. Choose package.\t\t||"<<endl;
cout<<"\t\t||\t2. Display list of customer.\t||"<<endl;
cout<<"\t\t||\t3. Exit program.\t\t||"<<endl;
cout<<"\t\t========================================="<<endl;
cout<<"\n\nPlease select the menu : ";
cin>>menu;

return menu;

double destFare (int companyCode)


{
if (companyCode == 1)
{
strcpy (company, "AIR ASIA");
system("CLS");
cout << "--------------------------------------------------------------------------------" << endl;
cout << "\nCODE\t\tDESTINATION\t\t\tACTIVITY" << endl;
cout << "\nA\t\tPULAU LANGKAWI\t\ti) Island Hopping" << endl;
cout << "\t\t\t\t\tii) Snorkelling at Pulau Payar" << endl;
cout << "\t\t\t\t\tiii) Cable Car" << endl;
cout << "\t\t\t\t\tiv) Underwater World" << endl;
cout << "\t\t\t\t\tv) Visiting Makam Mahsuri" << endl;
cout << "\nB\t\tPULAU TIOMAN\t\ti) Island Hopping" << endl;
cout << "\t\t\t\t\tii) Snorkelling" << endl;
cout << "\t\t\t\t\tiii) Scuba Diving" << endl;
cout << "\t\t\t\t\tiv) Rock Climbing" << endl;
cout << "\t\t\t\t\tv) Waterfall" << endl;
cout << "\nC\t\tPULAU PANGKOR\t\ti) Island Hopping" << endl;
cout << "\t\t\t\t\tii) Snorkelling" << endl;
cout << "\t\t\t\t\tiii) Hornbill's Feeding" << endl;
cout << "\t\t\t\t\tiv) Beach's games (Banana Boat, Ski)" << endl;
cout << "\t\t\t\t\tv) Visiting 'Kota Belanda'" << endl;
cout << "--------------------------------------------------------------------------------" << endl;

cout << "PLEASE CHOOSE THE DESTINATION CODE: ";


cin >> destCode;
cout << "PLEASE ENTER THE NUMBER OF ADULT: ";
cin >> noAdult;
cout << "PLEASE ENTER THE NUMBER OF CHILDREN: ";
cin >> noChild;

if (destCode == 'A' || destCode == 'a')


{
strcpy (destination, "PULAU LANGKAWI");
adult = 294.30;
children = 255.50;
}

else if (destCode == 'B' || destCode == 'b')


file:///C:/Users/asus/Desktop/CSC/Mini project/6/Group Project CSC.html 2/4
12/11/2019 Group Project CSC.html
{
strcpy (destination, "PULAU TIOMAN");
adult = 484.00;
children = 344.00;
}

else if (destCode == 'C' || destCode == 'c')


{
strcpy (destination, "PULAU PANGKOR");
adult = 510.00;
children = 398.00;
}

else
{
strcpy (destination, "INVALID");
adult = 0.00;
children = 0.00;
}

destPrice = (noAdult*adult) + (noChild*children);


return destPrice;
}

else if (companyCode == 2)
{
strcpy (company, "MALINDO AIRLINES");
system("CLS");
cout << "-------------------------------------------------------------------------------------" << endl;
cout << "\nCODE\t\tDESTINATION\t\t\tACTIVITY" << endl;
cout << "\nA\t\tKOTA KINABALU\t\ti) Monsopiad Cultural Village" << endl;
cout << "\t\t\t\t\tii) OrangUtan Rehabilitation Centre" << endl;
cout << "\t\t\t\t\tiii) Rainforest Discovery Centre" << endl;
cout << "\t\t\t\t\tiv) Pulau Sipadan" << endl;
cout << "\t\t\t\t\tv) Poring Hotspring" << endl;
cout << "\nB\t\tKUCHING\t\t\ti) Taman Negara Bako" << endl;
cout << "\t\t\t\t\tii) Kampung Budaya Sarawak" << endl;
cout << "\t\t\t\t\tiii) Golden Bridge" << endl;
cout << "\t\t\t\t\tiv) Annah Rais Hotspring" << endl;
cout << "\t\t\t\t\tv) Permai Rainforest Resort" << endl;
cout << "\nC\t\tBRUNEI\t\t\ti) Hutan Simpan Labi" << endl;
cout << "\t\t\t\t\tii) Tasek Merimbun" << endl;
cout << "\t\t\t\t\tiii) Royal Regalia Building" << endl;
cout << "\t\t\t\t\tiv) Billionth Barrel Monument" << endl;
cout << "\t\t\t\t\tv) The Cement Wreck" << endl;
cout << "-------------------------------------------------------------------------------------" << endl;

cout << "PLEASE CHOOSE THE DESTINATION CODE: ";


cin >> destCode;
cout << "PLEASE ENTER THE NUMBER OF ADULT: ";
cin >> noAdult;
cout << "PLEASE ENTER THE NUMBER OF CHILDREN: ";
cin >> noChild;

if (destCode == 'A' || destCode == 'a')


{
strcpy (destination, "KOTA KINABALU");
adult = 1559.65;
children = 1091.76;
}

else if (destCode == 'B' || destCode == 'b')


{
strcpy (destination, "KUCHING");
adult = 1708.00;
children = 1220.00;
}

else if (destCode == 'C' || destCode == 'c')


{
strcpy (destination, "BRUNEI");
adult = 2206.80;
children = 1544.76;
}

else
{
strcpy (destination, "INVALID");
adult = 0.00;
children = 0.00;
}

destPrice = (noAdult*adult) + (noChild*children);


return destPrice;
}

else if (companyCode == 3 )
{
strcpy (company, "MALAYSIA AIRLINES");
system("CLS");
cout << "-------------------------------------------------------------------------------------" << endl;
cout << "\nCODE\t\tDESTINATION\t\t\tACTIVITY" << endl;
cout << "\nA\t\tSINGAPORE\t\ti) Gardens By The Bay" << endl;
cout << "\t\t\t\t\tii) Hawker Centre" << endl;
cout << "\t\t\t\t\tiii) Melion" << endl;
cout << "\t\t\t\t\tiv) Garden Rhapsody Show" << endl;
cout << "\t\t\t\t\tv) Universal Studio Singapore (USS)" << endl;
cout << "\nB\t\tHATYAI, THAILAND\ti) Pasar Terapung Klong Hae" << endl;
file:///C:/Users/asus/Desktop/CSC/Mini project/6/Group Project CSC.html 3/4
12/11/2019 Group Project CSC.html
cout << "\t\t\t\t\tii) Lanthen Festival" << endl;
cout << "\t\t\t\t\tiii) Magic Eye 3D Museum" << endl;
cout << "\t\t\t\t\tiv) Namtok Ton Nga Chang" << endl;
cout << "\t\t\t\t\tv) Greenway Night Market" << endl;
cout << "\nC\t\tBALI, INDONESIA\t\ti) Sacred Monkey Forest Sanctuary" << endl;
cout << "\t\t\t\t\tii) Ubud Palace" << endl;
cout << "\t\t\t\t\tiii) Seminyak Shopping" << endl;
cout << "\t\t\t\t\tiv) Rope-swing Ride" << endl;
cout << "\t\t\t\t\tv) Pura Tanah Lot" << endl;
cout << "-------------------------------------------------------------------------------------" << endl;

cout << "PLEASE CHOOSE THE DESTINATION CODE: ";


cin >> destCode;
cout << "PLEASE ENTER THE NUMBER OF ADULT: ";
cin >> noAdult;
cout << "PLEASE ENTER THE NUMBER OF CHILDREN: ";
cin >> noChild;

if (destCode == 'A' || destCode == 'a')


{
strcpy (destination, "SINGAPORE");
adult = 780.00;
children = 546.00;
}

else if (destCode == 'B' || destCode == 'b')


{
strcpy (destination, "HATYAI, THAILAND");
adult = 849.00;
children = 594.30;
}

else if (destCode == 'C' || destCode == 'c')


{
strcpy (destination, "BALI,INDONESIA");
adult = 959.00;
children = 671.30;
}

else
{
strcpy (destination, "INVALID");
adult = 0.00;
children = 0.00;
}

destPrice = (noAdult*adult) + (noChild*children);


return destPrice;
}

else
{
strcpy (company, "INVALID");
strcpy (destination, "INVALID");
destPrice=0;

return destPrice;
}
}

double calcService (double destPrice)


{
priceService = destPrice*0.01;
return priceService;
}

double calcTax (double destPrice, double &priceTax)


{
tax = destPrice*0.06;
priceTax = destPrice*1.06;
return tax;
}

double totPrice (double destPrice, double priceService, double tax, int i)


{
totalPrice[i] = destPrice + priceService + tax;
return totalPrice[i];
}

file:///C:/Users/asus/Desktop/CSC/Mini project/6/Group Project CSC.html 4/4

You might also like