-- If you know of a shorter way to do this .. post away plz
-- the nightscost and totalcost cause erros ( call to undefined function )
-- get a fair amount of warnings, but i can live with warnings
#include <iostream>
#include "Thefunctions.cpp"
using namespace std;
int main()
{
// function calls
void gettype1();
int choice;
double nights;
double tax;
double totalcost = 0.0;
double nightscost = 0.0;
// Displays all of the Motels cost information
cout << "Floor's 1-5 are $45.00 for a Single, $60.00 for a Double, and $130.00 for a Suite" << endl;
cout << "Floor's 6-11 are $55.00 for a Single, $72.00 for a Double, and $215.00 for a Suite" << endl;
cout << "The top floor rates are, $120.00 for a Double, and $350.00 for a Suite. We do not offer Single rooms on the 12th floor" << endl;
// Prompts user to enter the reservation information
cout << "Enter the type of room you wish for, 1(Single), 2(Double), 3(Suite):" << endl;
cin >> room;
cout << room << endl;
cout << "Enter which floor desired (1-12):" << endl;
cin >> choice;
cout << choice << endl;
cout << "Enter the number of nights you will be staying:" << endl;
cin >> nights;
cout << nights << endl;
// GET CALL TO UNDEFINED FUNCTIONS ON THESE TWO(nightscost & totalcost)
nightscost = nightsfunction(nights);
totalcost = totalfunction(totalcost, tax);
// Dispays the users' input
cout << "The nightly cost would be "<< nightscost << endl;
cout << "The total price would be " << totalcost << endl;
return 0;
}
-- FUNCTIONS
-- would have used a case statement but cant remember exact syntax
-- so i ended up abusing if statements /shrug
#include <iostream>
using namespace std;
int room;
int floor;
void gettype1(int choice)
{
if(room = '1' && floor <= 5)
{
rcost = 50;
}
if(room = '1' && floor >= 6 && floor <= 11)
{
rcost = 65;
}
if(room = '1' && floor = 12)
{
rcost = 150;
}
return;
}
{
if(room = '2' && floor <= 5)
{
rcost = 55;
}
if(room = '2' && floor >= 6 && floor <= 11)
{
rcost = 72;
}
if(room = '2' && floor = 12)
{
rcost = 215;
}
return;
}
if(room = '3' && floor <= 5)
{
cout << "Not available, we apologize." << endl;
}
if(room = '3' && floor >= 6 && floor <=11)
{
rcost = 120;
}
if(room = '3' && floor = 12)
{
rcost = 350;
return;
}
double nightsfunction(int nights, int room, double tax)
{
if(nights >= 4)
{stay = (nights * .10);}
}
double totalfunction(double totalcost, double tax)
{
double totalcost;
double stay;
tax += 1;
totalcost = (stay + rcost) * tax;
cout << "Your cost is " << totalcost << endl;
return totalcost;
}