External Exam Download Resources Web Applications Games Recycle Bin

RestaurantInformation.h

---------------------------------------------
Restaurant and Sitting Class Declaration File
(contains Reservation Structure declaration)
---------------------------------------------*/

#ifndef _RESTAURANTINFORMATION_H
#define _RESTAURANTINFORMATION_H

#include "stdafx.h"

using namespace System;
using namespace System::Collections;  //for Hashtable, etc
using namespace System::Threading;  //for Thread management

/******************************************************
Constant definitions: change these to suit restaurant -
*******************************************************/
#define SEATS_AVAILABLE_IN_RESTAURANT 30
#define NUMBER_OF_SITTINGS_TO_TAKE_BOOKINGS_FOR 2

/*********************************************************
Reservation Structure: used to hold data for reservations.
**********************************************************/
public ref struct Reservation {
	int which_sitting;
	String^ under_what_name;
	int total_in_party;
	Reservation(int, String^, int);
	Reservation();
};

/******************************************************
Sitting Class: A restaurant may have multiple sittings.
A bookings Hashtable will be used for each sitting to
store reservations.
*******************************************************/
public ref class Sitting
{
	public:
	String^ sitting_name;
	Hashtable^ bookings;
	Sitting(String^);
	~Sitting();
};

/*****************************************************
Restaurant Class: Provides necessary data structures
and methods for server to retrieve, process, store and
remove information on bookings.
******************************************************/
public ref class Restaurant
{
	private:
		//variables:
		static int num_of_sittings = NUMBER_OF_SITTINGS_TO_TAKE_BOOKINGS_FOR;
		static int num_of_seats = SEATS_AVAILABLE_IN_RESTAURANT;
		static int unique_reservation_key = 1; //increments by 1 for each booking taken
		array<Sitting^>^ restaurant_sitting; //an array of Sittings (each Sitting has its own Hashtable for bookings)

		//functions:
		void padRight(String^, int);
		void underline();
		void save_reservation(Reservation^);
		int count_num_places_avail(int);
		
	public:
		//constructor:
		Restaurant();

		//destructor:
		~Restaurant();

		//threads:		
		void addBooking(Object^);
		void deleteBooking(Object^);
		
		//methods:
		String^ feedback_reservation_key(Reservation^);
		String^ welcomeMessage();
		String^ seatsAvailableMessage();
		void generateConsoleBookingReport();
};


#endif