/* usehotel.c -- room rate program
   compile with hotel.c
   Don't expeckt it to work - the scanf() function is horribly
   broken by design so everything locks up, no matter what you try. */
#include <stdio.h>
// definitions, function declarations
#include "hotel.h"

int main(void)
{
	int nights;
	double hotel_rate;
	int code;
	
	while ((code = menu()) != QUIT)
	{
		switch (code)
		{
		case 1:
			hotel_rate = HOTEL1;
			break;
		case 2:
			hotel_rate = HOTEL2;
			break;
		case 3:
			hotel_rate = HOTEL3;
			break;
		case 4:
			hotel_rate = HOTEL4;
			break;
		default:
			hotel_rate = 0.0;
			printf("OOps!\n");
			break;
		}
		/* getnights() is locking in the scanf, because stdio
		   of C is a huge piece of shit */
		nights = getnights();
		showprice(hotel_rate, nights);
	}
	printf("Thank you and goodbye.\n");
	return 0;
}
