/*******************************************************************************
FILE		OLA2.CC
COURSE		CSCI-1170-006
AUTHOR		Patrick Riley Connor
INSTRUCTOR	Jungson Yoo
DUE DATE	22 September 2009
DESCRIPTION	This program generates a billing statement based on user input
		for a hotel, accounting for various user needs.
INPUT		guestName	Guest's name			string
		roomNum		Guest's room number		int
		roomRate	Nightly cost of room		float
		nights		Number of nights stayed		int
		phoneCost	Phone costs incurred		float
		extraCost	Other costs incurred		float
OUTPUT		1. Purpose of the program.
		2. Prompts asking for user's information.
		3. Billing statement, with extra calculations given.
FORMULAS	roomCost = roomRate * nights		Total cost for the room
		roomTax = roomCost * tax;		The tax for room costs
		subTotal = roomCost + roomTax;		Before other costs
		grandTotal = subTotal + phoneCost + extraCost	Costs compiled
*******************************************************************************/

using namespace std;
#include <iostream>	// Needed for cout and cin
#include <string>	// Needed for tracking our guest's name
#include <iomanip> 	// Needed for setprecision() and fixed

int main()
{
	int		roomNum,	// Guest's room number.
			nights;		// Number of nights stayed.
	float		roomRate,	// Nightly cost for room.
			roomCost,	// Total cost for all nights stayed.
			roomTax,	// Tax charged on room costs.
			subTotal,	// Total on room and tax.
			phoneCost,	// Phone costs incurred.
			extraCost,	// Other costs incurred.
			grandTotal;	// Subtotal, phone, and other costs.
	string		guestName;	// Name of the guest.
	const	float	tax = 0.0975;	// Sales tax.

	// State the purpose of our ever-so-benevolent program.
	cout 	<< 	"This program is used to generate a billing statement"
		<<	endl	<<	"for the Murfreesboro Hotel Inc.\n";
	

	// Start prompting for the guest details, such as...

	// ...their name...
	cout	<<	"Guest name: ";
	cin	>>	guestName;
	
	// ...their room number...
	cout	<<	"Room number: ";
	cin	>>	roomNum;

	// ...their room's nightly cost...
	cout	<<	"Room rate: $";
	cin	>>	roomRate;

	// ...the number of nights they stayed...
	cout	<<	"Number of nights: ";
	cin	>>	nights;

	// ...the costs incurred on their telephone...
	cout	<<	"Telephone charges: $";
	cin	>>	phoneCost;

	// ...and any other various costs.
	cout	<<	"Other charges, such as meals: $";
	cin	>>	extraCost;

	// Now that we have all of our user input, we can start making a few
	// calculations based on the user's input.

	roomCost = roomRate * nights;		// Total cost for the room.
	roomTax = roomCost * tax;		// The tax for room costs.
	subTotal = roomCost + roomTax;		// Subtotal before other costs.
	grandTotal = subTotal + phoneCost + extraCost;
					// Wrap all of our costs together.

	// Give ourselves a bit of room before we start feeding the user the
	// billing statement.
	cout	<<	endl	<<	endl	<<	endl	<<	endl

	// Set our output to truncate to 2 digits, as to satisfy normal rules of
	// using money.
		<<	fixed	<<	setprecision(2)

	// And now, the billing statement. Start pushing out all the information
	// requested. Note that we are still piggy-backing off of the cout
	// command located on line 86, as to avoid using fixed and setprecision
	// multiple times.
		<<	"Murfreesboro Hotel, Inc."		<<	endl
		<<	"-------------------------------------"	<<	endl
		<<	endl
		<<	"Guest name: "	<<	guestName	<<	endl
		<<	"Room number: "	<<	roomNum		<<	endl
		<<	"Room rate: $"	<<	roomRate	<<	endl
		<<	"Nights stayed: "	<<	nights	<<	endl
		<<	"Room cost: $"	<<	roomCost	<<	endl

	// For this segment, format the tax so it looks in a pretty percentile
	// format rather than a decimal.
		<<	"Tax @ "	<<	tax * 100	<< "%: $"
		<<	roomTax		<<	endl

		<<	"Subtotal: $"	<<	subTotal	<<	endl
		<<	"Phone bill: $"	<<	phoneCost	<<	endl
		<<	"Other bill: $"	<<	extraCost	<<	endl
		<<	"TOTAL: $"	<<	grandTotal	<<	endl

	// A little bit more padding, to give room for the closing.
		<< 	endl	<<	endl

	// ...and a complimentary closing. Notice the closing semicolon, finally
	// finishing the cout command started on line 86.
		<< 	"Thank you for staying with us at Murfreesboro"	<< endl
		<<	"Hotel. We hope you enjoyed your stay."		<< endl;

	// Woohoo! We're done!
	return 0;
}