1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
|
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <string>
//value-returning function prototypes
double getRoomTotal(double, char, double);
//double getFinalTotal (double, double, int, double);
//void function prototypes
//void displayInformation ()
using namespace std;
int main()
{
//declare constants
const double KING_SUITE_RATE = 280.00;
const double QUEEN_SUITE_RATE = 310.00;
const double KING_STND_RATE = 235.00;
const double QUEEN_STND_RATE = 255.00;
const double TAX_RATE = .15;
const string KING_SUITE = "King Suite";
const string QUEEN_SUITE = "Queen Suite";
const string KING_STND = "King Standard";
const string QUEEN_STND = "Queen Standard";
const string CURR_AMER = "American";
const string CURR_PES = "Pesos";
//declare variables
char reserveYN = ' ';
int roomChoice = 0;
double roomRate = 0.0;
double numNights = 0.0;
char currency = ' ';
string currChoice = "";
char grdTransYN = ' ';
int daysBus = 0;
double tourFee = 0.0;
char busTourYN = ' ';
double roomTotal = 0.0;
double finalTotal = 0.0;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//prompt user
cout << "Do you want to make another reservation, Y/N? " ;
cin >> reserveYN ;
reserveYN = toupper(reserveYN);
while ((reserveYN != 'Y') && (reserveYN != 'N'))
{
cout << "Please make a valid entry :" ;
cin >> reserveYN;
reserveYN = toupper(reserveYN);
cout << endl;
}
if (reserveYN == 'Y')
{
system("cls"); //clear screen
}
else if (reserveYN == 'N')
{
system("pause");
return 0;
} // end if-else
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Main loop
//while (reserveYN == 'Y')
//for (; reserveYN != 'N';)
{
cout << "Welcome to the Cancun Mexicana Resort! " << endl;
cout << "You man choose a room type of the following: " << endl;
cout << "************************************************************" << endl << endl;
cout << "1. King Suite ($280.00) " << endl;
cout << "2. 2 Queen Beds Suite ($310.00) " << endl;
cout << "3. King Standard Room ($235.00) " << endl;
cout << "4. 2 Queen Beds Standard Room ($255.00) " << endl;
cout << "************************************************************" << endl;
cout << "What is your choice? " ;
cin >> roomChoice;
//menu switch
switch (roomChoice)
{
case 1:
roomRate = KING_SUITE_RATE;
break;
case 2:
roomRate = QUEEN_SUITE_RATE;
break;
case 3:
roomRate = KING_STND_RATE;
break;
case 4:
roomRate = QUEEN_STND_RATE;
break;
default:
cout << "You have made an invalid choice...Please choose an option between 1 & 4 " << endl;
cin >> roomChoice;
while ((roomChoice > 4) || (roomChoice < 1));
} //end switch
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Number of nights
cout << endl << "How many nights would you like to stay (must be greater than 0) : " ;
cin >> numNights;
cout << endl;
while (numNights < 1)
{
cout << "Please enter a valid number greater than 0 :" ;
cin >> numNights;
} //end while
cout << "You would like to stay " << numNights << " nights " << endl << endl;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Currency
cout << "Please enter a currency type: A for American or P for Pesos " ;
cin >> currency;
currency = toupper(currency);
cout << endl;
while ((currency != 'A')&& (currency != 'P'))
{
cout << "Please make a valid entry of A or P :" ;
cin >> currency;
currency = toupper(currency);
cout << endl;
}
if (currency == 'A')
currChoice = CURR_AMER;
else if (currency == 'P')
currChoice = CURR_PES;
cout << "You have chose " << currChoice << " currency " << endl << endl;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Ground Transportation Question
cout << "Do you need ground transportation (Y/N)? " ;
cin >> grdTransYN;
grdTransYN = toupper(grdTransYN);
cout << endl;
if (grdTransYN == 'Y')
{
cout << "How many days will you need transportation ? " ;
cin >> daysBus;
cout << endl;
}
else if(grdTransYN == 'N')
cout << endl;
while ((grdTransYN != 'Y') && (grdTransYN != 'N'))
{
cout << "Please make a valid entry :" ;
cin >> grdTransYN;
grdTransYN = toupper(grdTransYN);
cout << endl;
}
if (daysBus < 0)
{
cout << "Please chose a value greater than 0: " ;
cin >> daysBus;
cout << endl;
}
cout << "You have requested transportation for " << daysBus << " days " << endl;
cout << endl;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Bus Tour Question
cout << "Do you want a bus tour (Y/N) ? " ;
cin >> busTourYN;
busTourYN = toupper(busTourYN);
cout << endl;
while ((busTourYN != 'Y') && (busTourYN != 'N'))
{
cout << "Please make a valid entry :" ;
cin >> busTourYN;
busTourYN = toupper(busTourYN);
cout << endl;
} //end while
if (busTourYN == 'Y')
{
tourFee = 10.00;
cout << "Great! The tour fee is " << tourFee << endl;
}
else if (busTourYN == 'N')
{
tourFee = 0.0;
cout << "You have chose to NOT have a bus tour " << endl;
cout << endl;
} //end if
}
system("pause");
return 0;
}
//end of main function
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Call functions
roomTotal = getRoomTotal(roomRate, currency, numNights);
cout << roomTotal;
// finalTotal = getFinalTotal(roomTotal, tax, daysBus, tourFee)
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Function getRoomTotal definition
double getRoomTotal(double rate, char curr, double nights)
{
double total = 0.0;
//calculates the price according to number of days and currency
if (curr == 'A')
{
total = (rate * nights) * 1;
}
else if (curr == 'P')
{
total = (rate * nights) * 10.5644;
}
//end if
return total;
} //end getRoomTotal function
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Function getFinalTotal definition
// double getFinalTotal (double room, double taxCalc, int trans, double tour)
// {
// double finTot = 0.0;
// //calculates the final total including the tax and extras
// finTot = (room * taxCalc) + (trans + tour);
// return finTot;
// } //end getFinalTotal
//end main loop
|